From 2a874332f535d13ae0dbe3ced6cd5cd55ae74f93 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 8 Mar 2024 20:52:36 -0500 Subject: nix flake & env upkeep --- flake.nix | 97 ++++++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 75 insertions(+), 22 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 78e0d8e..b1be7ea 100644 --- a/flake.nix +++ b/flake.nix @@ -47,7 +47,7 @@ in { packages = forAllSystems (system: let pkgs-ovl = pkgsForSystem system; - pkgs = nixpkgsFor.${system}; + pkgs-nix = nixpkgsFor.${system}; in with pkgs-ovl; { default = stdenv.mkDerivation { @@ -59,7 +59,7 @@ inherit shell; inherit devEnv; buildInputs = [sqlite]; - nativeBuildInputs = [dub ldc gnumake]; # [ dub dmd ]; [ dub ldc ]; [ dub gdc ]; + nativeBuildInputs = [dub ldc gnumake]; buildPhase = '' runHook preBuild for DC_ in dmd ldmd2 ldc2 gdc gdmd; do @@ -69,7 +69,10 @@ done if [ "$DC" == "" ]; then exit "Error: could not find D compiler"; fi echo "$DC_ used as D compiler to build $pname" - dub build --cache=local --compiler=$DC --build=$DC_ --combined --skip-registry=all + buildCMD="dub build --cache=local --compiler=$DC --build=$DC_ --combined --skip-registry=all" + echo $buildCMD + $buildCMD + echo $buildCMD runHook postBuild ''; inherit preBuild; @@ -77,7 +80,7 @@ inherit installPhase; inherit postInstall; }; - spine-overlay-dmd = stdenv.mkDerivation { + spine-nixpkgs-dmd = stdenv.mkDerivation { inherit pname; inherit version; meta.mainProgram = "spine-dmd"; @@ -85,11 +88,14 @@ src = self; inherit shell; inherit devEnv; - buildInputs = [sqlite]; - nativeBuildInputs = [dub dmd gnumake]; + buildInputs = with pkgs-nix; [sqlite]; + nativeBuildInputs = with pkgs-nix; [dub dmd gnumake]; buildPhase = '' runHook preBuild - dub build --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all + buildCMD="dub build --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all" + echo $buildCMD + $buildCMD + echo $buildCMD runHook postBuild ''; inherit preBuild; @@ -97,7 +103,7 @@ inherit installPhase; inherit postInstall; }; - spine-overlay-ldc = stdenv.mkDerivation { + spine-nixpkgs-ldc = stdenv.mkDerivation { inherit pname; inherit version; meta.mainProgram = "spine-ldc"; @@ -105,11 +111,37 @@ src = self; inherit shell; inherit devEnv; + buildInputs = with pkgs-nix; [sqlite]; + nativeBuildInputs = with pkgs-nix; [dub ldc gnumake]; + buildPhase = '' + runHook preBuild + buildCMD="dub build --cache=local --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all" + echo $buildCMD + $buildCMD + echo $buildCMD + runHook postBuild + ''; + inherit preBuild; + inherit checkPhase; + inherit installPhase; + inherit postInstall; + }; + spine-overlay-dmd = stdenv.mkDerivation { + inherit pname; + inherit version; + meta.mainProgram = "spine-dmd"; + executable = true; + src = self; + inherit shell; + inherit devEnv; buildInputs = [sqlite]; - nativeBuildInputs = [dub ldc gnumake]; + nativeBuildInputs = [dub dmd gnumake]; buildPhase = '' runHook preBuild - dub build --cache=local --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all + buildCMD="dub build --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all" + echo $buildCMD + $buildCMD + echo $buildCMD runHook postBuild ''; inherit preBuild; @@ -117,7 +149,7 @@ inherit installPhase; inherit postInstall; }; - spine-nixpkgs-ldc = stdenv.mkDerivation { + spine-overlay-ldc = stdenv.mkDerivation { inherit pname; inherit version; meta.mainProgram = "spine-ldc"; @@ -125,11 +157,14 @@ src = self; inherit shell; inherit devEnv; - buildInputs = with pkgs; [sqlite]; - nativeBuildInputs = with pkgs; [dub ldc gnumake]; + buildInputs = [sqlite]; + nativeBuildInputs = [dub ldc gnumake]; buildPhase = '' runHook preBuild - dub build --cache=local --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all + buildCMD="dub build --cache=local --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all" + echo $buildCMD + $buildCMD + echo $buildCMD runHook postBuild ''; inherit preBuild; @@ -167,7 +202,7 @@ }); devShells = forAllSystems (system: let pkgs-ovl = pkgsForSystem system; - pkgs = nixpkgsFor.${system}; + pkgs-nix = nixpkgsFor.${system}; shellHook = '' export DFLAGS="-O2 -boundscheck=on" export Date=`date "+%Y%m%d"` @@ -178,8 +213,6 @@ name = "spine base dev shell"; inherit shell; inherit devEnv; - #buildInputs = [ sqlite ]; - #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ ldc #dmd @@ -189,12 +222,34 @@ ]; inherit shellHook; }; + dsh-nixpkgs-dmd-dub = mkShell { + name = "spine base dev shell"; + inherit shell; + inherit devEnv; + packages = with pkgs-nix; [ + dmd + dub + gnumake + sqlite + ]; + inherit shellHook; + }; + dsh-nixpkgs-ldc-dub = mkShell { + name = "spine base dev shell"; + inherit shell; + inherit devEnv; + packages = with pkgs-nix; [ + ldc + dub + gnumake + sqlite + ]; + inherit shellHook; + }; dsh-overlay-dmd-dub = mkShell { name = "spine base dev shell"; inherit shell; inherit devEnv; - #buildInputs = [ sqlite ]; - #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ dmd dub @@ -207,8 +262,6 @@ name = "spine base dev shell"; inherit shell; inherit devEnv; - #buildInputs = [ sqlite ]; - #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ ldc dub @@ -302,7 +355,7 @@ ]; inherit shellHook; }; - default = import ./shell.nix {inherit pkgs;}; + default = import ./shell.nix {inherit pkgs-nix;}; }); }; } -- cgit v1.2.3