i think? this is better??
This commit is contained in:
parent
b3e79b56f7
commit
c3b829b68f
11 changed files with 413 additions and 678 deletions
286
flake.nix
286
flake.nix
|
@ -1,143 +1,143 @@
|
|||
{
|
||||
description = "C/C++ environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
treefmt-nix,
|
||||
utils,
|
||||
...
|
||||
}:
|
||||
utils.lib.eachDefaultSystem (
|
||||
system: let
|
||||
pkgs = import nixpkgs {inherit system;};
|
||||
|
||||
llvmPackages = with pkgs;
|
||||
if hostPlatform.isLinux
|
||||
then llvmPackages_20
|
||||
else llvmPackages_19;
|
||||
|
||||
stdenv = with pkgs;
|
||||
(
|
||||
if hostPlatform.isLinux
|
||||
then stdenvAdapters.useMoldLinker
|
||||
else lib.id
|
||||
)
|
||||
llvmPackages.stdenv;
|
||||
|
||||
sources = import ./_sources/generated.nix {
|
||||
inherit (pkgs) fetchFromGitHub fetchgit fetchurl dockerTools;
|
||||
};
|
||||
|
||||
fmt = pkgs.pkgsStatic.fmt.overrideAttrs (old: {
|
||||
inherit (sources.fmt) pname version src;
|
||||
});
|
||||
|
||||
tomlplusplus = pkgs.pkgsStatic.tomlplusplus.overrideAttrs {
|
||||
inherit (sources.tomlplusplus) pname version src;
|
||||
doCheck = false;
|
||||
};
|
||||
|
||||
deps = with pkgs.pkgsStatic;
|
||||
[
|
||||
curl
|
||||
fmt
|
||||
libiconv
|
||||
tomlplusplus
|
||||
nlohmann_json
|
||||
sqlitecpp
|
||||
ftxui
|
||||
]
|
||||
++ linuxPkgs;
|
||||
|
||||
linuxPkgs = nixpkgs.lib.optionals stdenv.isLinux (with pkgs;
|
||||
[
|
||||
valgrind
|
||||
]
|
||||
++ (with pkgsStatic; [
|
||||
dbus
|
||||
xorg.libX11
|
||||
wayland
|
||||
]));
|
||||
in
|
||||
with pkgs; {
|
||||
packages = rec {
|
||||
draconisplusplus = stdenv.mkDerivation {
|
||||
name = "draconis++";
|
||||
version = "0.1.0";
|
||||
src = self;
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
meson
|
||||
ninja
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = deps;
|
||||
|
||||
configurePhase = ''
|
||||
meson setup build
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
meson compile -C build
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
mv build/draconis++ $out/bin/draconis++
|
||||
'';
|
||||
};
|
||||
|
||||
default = draconisplusplus;
|
||||
};
|
||||
|
||||
formatter = treefmt-nix.lib.mkWrapper pkgs {
|
||||
projectRootFile = "flake.nix";
|
||||
programs = {
|
||||
alejandra.enable = true;
|
||||
deadnix.enable = true;
|
||||
|
||||
clang-format = {
|
||||
enable = true;
|
||||
package = pkgs.llvmPackages.clang-tools;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
devShell = mkShell.override {inherit stdenv;} {
|
||||
packages =
|
||||
[
|
||||
alejandra
|
||||
bear
|
||||
llvmPackages.clang-tools
|
||||
cmake
|
||||
lldb
|
||||
hyperfine
|
||||
meson
|
||||
ninja
|
||||
nvfetcher
|
||||
pkg-config
|
||||
unzip
|
||||
|
||||
(writeScriptBin "build" "meson compile -C build")
|
||||
(writeScriptBin "clean" "meson setup build --wipe")
|
||||
(writeScriptBin "run" "meson compile -C build && build/draconis++")
|
||||
]
|
||||
++ deps;
|
||||
|
||||
LD_LIBRARY_PATH = "${lib.makeLibraryPath deps}";
|
||||
NIX_ENFORCE_NO_NATIVE = 0;
|
||||
|
||||
name = "C++";
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
{
|
||||
description = "C/C++ environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
treefmt-nix,
|
||||
utils,
|
||||
...
|
||||
}:
|
||||
utils.lib.eachDefaultSystem (
|
||||
system: let
|
||||
pkgs = import nixpkgs {inherit system;};
|
||||
|
||||
llvmPackages = with pkgs;
|
||||
if hostPlatform.isLinux
|
||||
then llvmPackages_20
|
||||
else llvmPackages_19;
|
||||
|
||||
stdenv = with pkgs;
|
||||
(
|
||||
if hostPlatform.isLinux
|
||||
then stdenvAdapters.useMoldLinker
|
||||
else lib.id
|
||||
)
|
||||
llvmPackages.stdenv;
|
||||
|
||||
sources = import ./_sources/generated.nix {
|
||||
inherit (pkgs) fetchFromGitHub fetchgit fetchurl dockerTools;
|
||||
};
|
||||
|
||||
fmt = pkgs.pkgsStatic.fmt.overrideAttrs (old: {
|
||||
inherit (sources.fmt) pname version src;
|
||||
});
|
||||
|
||||
tomlplusplus = pkgs.pkgsStatic.tomlplusplus.overrideAttrs {
|
||||
inherit (sources.tomlplusplus) pname version src;
|
||||
doCheck = false;
|
||||
};
|
||||
|
||||
deps = with pkgs.pkgsStatic;
|
||||
[
|
||||
curl
|
||||
fmt
|
||||
ftxui
|
||||
libiconv
|
||||
sqlitecpp
|
||||
tomlplusplus
|
||||
]
|
||||
++ linuxPkgs;
|
||||
|
||||
linuxPkgs = nixpkgs.lib.optionals stdenv.isLinux (with pkgs;
|
||||
[
|
||||
valgrind
|
||||
(glaze.override {enableAvx2 = true;})
|
||||
]
|
||||
++ (with pkgsStatic; [
|
||||
dbus
|
||||
xorg.libX11
|
||||
wayland
|
||||
]));
|
||||
in
|
||||
with pkgs; {
|
||||
packages = rec {
|
||||
draconisplusplus = stdenv.mkDerivation {
|
||||
name = "draconis++";
|
||||
version = "0.1.0";
|
||||
src = self;
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
meson
|
||||
ninja
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = deps;
|
||||
|
||||
configurePhase = ''
|
||||
meson setup build
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
meson compile -C build
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
mv build/draconis++ $out/bin/draconis++
|
||||
'';
|
||||
};
|
||||
|
||||
default = draconisplusplus;
|
||||
};
|
||||
|
||||
formatter = treefmt-nix.lib.mkWrapper pkgs {
|
||||
projectRootFile = "flake.nix";
|
||||
programs = {
|
||||
alejandra.enable = true;
|
||||
deadnix.enable = true;
|
||||
|
||||
clang-format = {
|
||||
enable = true;
|
||||
package = pkgs.llvmPackages.clang-tools;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
devShell = mkShell.override {inherit stdenv;} {
|
||||
packages =
|
||||
[
|
||||
alejandra
|
||||
bear
|
||||
llvmPackages.clang-tools
|
||||
cmake
|
||||
lldb
|
||||
hyperfine
|
||||
meson
|
||||
ninja
|
||||
nvfetcher
|
||||
pkg-config
|
||||
unzip
|
||||
|
||||
(writeScriptBin "build" "meson compile -C build")
|
||||
(writeScriptBin "clean" "meson setup build --wipe")
|
||||
(writeScriptBin "run" "meson compile -C build && build/draconis++")
|
||||
]
|
||||
++ deps;
|
||||
|
||||
LD_LIBRARY_PATH = "${lib.makeLibraryPath deps}";
|
||||
NIX_ENFORCE_NO_NATIVE = 0;
|
||||
|
||||
name = "C++";
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue