From 446c0feadf7ca4a3289a5a0c9e0bbe0e74801f12 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 4 Jun 2023 18:18:21 -0400 Subject: nix use overlays when convenient --- flake.nix | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 9 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 7e89065..4f487f0 100644 --- a/flake.nix +++ b/flake.nix @@ -19,6 +19,18 @@ dub test --combined --skip-registry=all runHook postCheck ''; + localOverlay = (final: prev: { + ldc = prev.callPackage ./nix-overlays/ldc { }; + dmd = prev.callPackage ./nix-overlays/dmd { }; + dub = prev.callPackage ./nix-overlays/dub { }; # -> ? + #gdc = prev.callPackage ./nix-overlays/gdc { }; # empty + }); + pkgsForSystem = system: import nixpkgs { + overlays = [ + localOverlay + ]; + inherit system; + }; installPhase = '' runHook preInstall mkdir -p $out/bin @@ -31,9 +43,10 @@ ''; in { packages = forAllSystems (system: let + pkgs-ovl = pkgsForSystem system; pkgs = nixpkgsFor.${system}; in - with pkgs; { + with pkgs-ovl; { default = stdenv.mkDerivation { inherit pname; inherit version; @@ -53,7 +66,7 @@ done if [ "$DC" == "" ]; then exit "Error: could not find D compiler"; fi echo "$DC_ used as D compiler to build $pname" - dub build --compiler=$DC --build=$DC_ --combined --skip-registry=all + dub build --cache=local --compiler=$DC --build=$DC_ --combined --skip-registry=all runHook postBuild ''; inherit checkPhase; @@ -72,7 +85,7 @@ nativeBuildInputs = [dub dmd gnumake]; buildPhase = '' runHook preBuild - dub build --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all + dub build --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all runHook postBuild ''; inherit checkPhase; @@ -91,7 +104,7 @@ nativeBuildInputs = [dub ldc gnumake]; buildPhase = '' runHook preBuild - dub build --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all + dub build --cache=local --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all runHook postBuild ''; inherit checkPhase; @@ -110,7 +123,7 @@ # nativeBuildInputs = [ dub gdc gnumake ]; # buildPhase = '' # runHook preBuild - # dub build --compiler=$(type -P gdc) --build=gdc --combined --skip-registry=all + # dub build --cache=local --compiler=$(type -P gdc) --build=gdc --combined --skip-registry=all # runHook postBuild # ''; # inherit checkPhase; @@ -126,13 +139,14 @@ }; }); devShells = forAllSystems (system: let + pkgs-ovl = pkgsForSystem system; pkgs = nixpkgsFor.${system}; shellHook = '' - export DFLAGS="-O2 -inline -boundscheck=on -color=on" + export DFLAGS="-O2 -boundscheck=on" export Date=`date "+%Y%m%d"` ''; in - with pkgs; { + with pkgs-ovl; { devShell = mkShell { name = "spine base dev shell"; inherit shell; @@ -141,9 +155,37 @@ #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ sqlite - dub + ldc #dmd + dub + gnumake + ]; + inherit shellHook; + }; + devShell-dmd = mkShell { + name = "spine base dev shell"; + inherit shell; + inherit devEnv; + #buildInputs = [ sqlite ]; + #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; + packages = [ + sqlite + dmd + dub + gnumake + ]; + inherit shellHook; + }; + devShell-ldc = mkShell { + name = "spine base dev shell"; + inherit shell; + inherit devEnv; + #buildInputs = [ sqlite ]; + #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; + packages = [ + sqlite ldc + dub gnumake ]; inherit shellHook; @@ -154,7 +196,7 @@ inherit devEnv; packages = [ dub - dmd + #dmd ldc gnumake sqlite -- cgit v1.2.3