From 0a1a8ce68c7b27cc4e86e9fab71a99e311d9e7d0 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph.amissah@gmail.com>
Date: Tue, 7 May 2024 10:11:24 -0400
Subject: configuration a& build related

---
 flake.nix | 73 +++++++++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 48 insertions(+), 25 deletions(-)

(limited to 'flake.nix')

diff --git a/flake.nix b/flake.nix
index d5c9317..2a6115c 100644
--- a/flake.nix
+++ b/flake.nix
@@ -29,7 +29,7 @@
       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
+      #gdc = prev.callPackage ./nix-overlays/gdc {  };
     });
     pkgsForSystem = system: import nixpkgs {
       overlays = [
@@ -54,7 +54,7 @@
       pkgs-ovl = pkgsForSystem system;
       pkgs-nix = nixpkgsFor.${system};
     in
-      with pkgs-ovl; {
+      with pkgs-nix; {
         default = stdenv.mkDerivation {
           inherit pname;
           inherit version;
@@ -73,7 +73,7 @@
             done
             if [ "$DC" == "" ]; then exit "Error: could not find D compiler"; fi
             echo "$DC_ used as D compiler to build $pname"
-            buildCMD="dub build --cache=local --compiler=$DC --build=$DC_ --combined --skip-registry=all"
+            buildCMD="dub run --cache=local --compiler=$DC --build=$DC_ --combined --skip-registry=all"
             echo $buildCMD
             $buildCMD
             echo $buildCMD
@@ -92,11 +92,11 @@
           src = self;
           inherit shell;
           inherit devEnv;
-          buildInputs = with pkgs-nix; [sqlite];
-          nativeBuildInputs = with pkgs-nix; [dub dmd gnumake];
+          buildInputs = [sqlite];
+          nativeBuildInputs = [dub dmd gnumake];
           buildPhase = ''
             runHook preBuild
-            buildCMD="dub build --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all"
+            buildCMD="dub run --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all"
             echo $buildCMD
             $buildCMD
             echo $buildCMD
@@ -115,11 +115,11 @@
           src = self;
           inherit shell;
           inherit devEnv;
-          buildInputs = with pkgs-nix; [sqlite];
-          nativeBuildInputs = with pkgs-nix; [dub ldc gnumake];
+          buildInputs = [sqlite];
+          nativeBuildInputs = [dub ldc gnumake];
           buildPhase = ''
             runHook preBuild
-            buildCMD="dub build --cache=local --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all"
+            buildCMD="dub run --cache=local --compiler=$(type -P ldmd2) --build=ldmd2 --combined --skip-registry=all"
             echo $buildCMD
             $buildCMD
             echo $buildCMD
@@ -138,11 +138,11 @@
           src = self;
           inherit shell;
           inherit devEnv;
-          buildInputs = [sqlite];
-          nativeBuildInputs = [dub dmd gnumake];
+          buildInputs = with pkgs-ovl; [sqlite];
+          nativeBuildInputs = with pkgs-ovl; [dub dmd gnumake];
           buildPhase = ''
             runHook preBuild
-            buildCMD="dub build --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all"
+            buildCMD="dub run --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all"
             echo $buildCMD
             $buildCMD
             echo $buildCMD
@@ -161,11 +161,11 @@
           src = self;
           inherit shell;
           inherit devEnv;
-          buildInputs = [sqlite];
-          nativeBuildInputs = [dub ldc gnumake];
+          buildInputs = with pkgs-ovl; [sqlite];
+          nativeBuildInputs = with pkgs-ovl; [dub ldc gnumake];
           buildPhase = ''
             runHook preBuild
-            buildCMD="dub build --cache=local --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all"
+            buildCMD="dub run --cache=local --compiler=$(type -P ldmd2) --build=ldmd2 --combined --skip-registry=all"
             echo $buildCMD
             $buildCMD
             echo $buildCMD
@@ -184,11 +184,11 @@
         #  src = self;
         #  inherit shell;
         #  inherit devEnv;
-        #  buildInputs = [ sqlite ];
-        #  nativeBuildInputs = [ dub gdc gnumake ];
+        #  buildInputs = with pkgs-ovl; [ sqlite ];
+        #  nativeBuildInputs = with pkgs-ovl; [ dub gdc gnumake ];
         #  buildPhase = ''
         #    runHook preBuild
-        #    dub build --cache=local --compiler=$(type -P gdc) --build=gdc --combined --skip-registry=all
+        #    dub run --cache=local --compiler=$(type -P gdc) --build=gdc --combined --skip-registry=all
         #    runHook postBuild
         #  '';
         #  inherit preBuild;
@@ -202,17 +202,17 @@
       pkgs-ovl = pkgsForSystem system;
       pkgs-nix = nixpkgsFor.${system};
       shellHook = ''
-        export DFLAGS="-O2 -boundscheck=on"
         export Date=`date "+%Y%m%d"`
         ## set local values in .envrc-local (or here if you must)
       '';
     in
-      with pkgs-ovl; {
+      with pkgs-nix; {
+        dsh-d-overlay = d-overlay.devShells.${system}.default;
         dsh-overlay = mkShell {
           name = "spine base dev shell";
           inherit shell;
           inherit devEnv;
-          packages = [
+          packages = with pkgs-ovl; [
             ldc
             #dmd
             dub
@@ -221,8 +221,7 @@
           ];
           inherit shellHook;
         };
-        dsh-d-overlay = d-overlay.devShells.${system}.default;
-        dsh-overlay-dmd-dub = mkShell {
+        dsh-nixpkgs-dmd-dub = mkShell {
           name = "spine base dev shell";
           inherit shell;
           inherit devEnv;
@@ -235,10 +234,34 @@
           inherit shellHook;
         };
         dsh-nixpkgs-ldc-dub = mkShell {
-          name = "nixpkgs - ldc - dub";
+          name = "spine base dev shell";
+          inherit shell;
+          inherit devEnv;
+          packages = [
+            ldc
+            dub
+            gnumake
+            sqlite
+          ];
+          inherit shellHook;
+        };
+        dsh-overlay-dmd-dub = mkShell {
+          name = "spine base dev shell";
+          inherit shell;
+          inherit devEnv;
+          packages = with pkgs-ovl; [
+            dmd
+            dub
+            gnumake
+            sqlite
+          ];
+          inherit shellHook;
+        };
+        dsh-overlay-ldc-dub = mkShell {
+          name = "spine base dev shell";
           inherit shell;
           inherit devEnv;
-          packages = with pkgs-nix; [
+          packages = with pkgs-ovl; [
             ldc
             dub
             gnumake
-- 
cgit v1.2.3