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 --- .env/nix-commands | 1 - .envrc-nix | 13 +++++- devenv.nix | 3 +- flake.nix | 97 +++++++++++++++++++++++++++++++++---------- org/config_env.org | 13 +++++- org/config_nix.org | 118 ++++++++++++++++++++++++++++++++++++++--------------- shell.nix | 13 +++--- 7 files changed, 192 insertions(+), 66 deletions(-) diff --git a/.env/nix-commands b/.env/nix-commands index 8a16dbf..de52220 100644 --- a/.env/nix-commands +++ b/.env/nix-commands @@ -3,7 +3,6 @@ - nix build ".#default" --print-build-logs - nix build ".#spine-dmd" --print-build-logs - nix build ".#spine-ldc" --print-build-logs -- nix build ".#spine-gdc" --print-build-logs - nix develop - nix develop ".#devShell" --print-build-logs diff --git a/.envrc-nix b/.envrc-nix index 5f4933a..860dd2b 100644 --- a/.envrc-nix +++ b/.envrc-nix @@ -15,7 +15,7 @@ watch_file .envrc-nix PATH_add result/bin use flake . #use flake .#default -echo " +echo ' - consider running: ❯❯ nix flake show ❯❯ nix flake update && nix flake check && nix flake show @@ -23,10 +23,19 @@ echo " - for a dev shell: ❯❯ nix develop ❯❯ nix develop ".#" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-nixpkgs-dmd-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-overlay-dmd-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-nixpkgs-ldc-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-overlay-ldc-dub" --print-build-logs -c zsh + ❯❯ nix flake show - to build project: + ❯❯ nix build --print-build-logs + ❯❯ nix build ".#" --print-build-logs + ❯❯ nix build ".#spine-nixpkgs-dmd" --print-build-logs + ❯❯ nix build ".#spine-overlay-dmd" --print-build-logs ❯❯ nix build ".#spine-nixpkgs-ldc" --print-build-logs ❯❯ nix build ".#spine-overlay-ldc" --print-build-logs - (see nix other/additional build options): ❯❯ nix flake show -" +' diff --git a/devenv.nix b/devenv.nix index af6d58d..54de1c8 100644 --- a/devenv.nix +++ b/devenv.nix @@ -16,7 +16,7 @@ with pkgs; nix-output-monitor nix-tree jq #gx - alejandra + #alejandra git # ❯❯❯ dev gnumake @@ -25,6 +25,7 @@ with pkgs; # ❯❯ package manager dub # ❯❯ compiler + #dmd ldc # ❯❯❯ sqlite search related sqlite 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;}; }); }; } diff --git a/org/config_env.org b/org/config_env.org index ffd497a..79dfb02 100644 --- a/org/config_env.org +++ b/org/config_env.org @@ -71,7 +71,7 @@ watch_file .envrc-nix PATH_add result/bin use flake . #use flake .#default -echo " +echo ' - consider running: ❯❯ nix flake show ❯❯ nix flake update && nix flake check && nix flake show @@ -79,13 +79,22 @@ echo " - for a dev shell: ❯❯ nix develop ❯❯ nix develop ".#" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-nixpkgs-dmd-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-overlay-dmd-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-nixpkgs-ldc-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-overlay-ldc-dub" --print-build-logs -c zsh + ❯❯ nix flake show - to build project: + ❯❯ nix build --print-build-logs + ❯❯ nix build ".#" --print-build-logs + ❯❯ nix build ".#spine-nixpkgs-dmd" --print-build-logs + ❯❯ nix build ".#spine-overlay-dmd" --print-build-logs ❯❯ nix build ".#spine-nixpkgs-ldc" --print-build-logs ❯❯ nix build ".#spine-overlay-ldc" --print-build-logs - (see nix other/additional build options): ❯❯ nix flake show -" +' #+END_SRC *** 3.0.0 diff --git a/org/config_nix.org b/org/config_nix.org index df7a3d0..f1073bd 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -23,7 +23,7 @@ #+BEGIN_SRC nix { description = "a sisu like parser & document generator"; - inputs.nixpkgs.url = "<>"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; inputs.flake-utils.url = "github:numtide/flake-utils"; outputs = { self, @@ -31,7 +31,7 @@ flake-utils, } @ inputs: let pname = "spine"; - version = "<>"; + version = "0.14.0"; shell = ./shell.nix; # ./default.nix; devEnv = ./nixDevEnv.sh; # ./shell.nix; # ./default.nix; # ./.envrc; supportedSystems = ["x86_64-linux"]; # [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; @@ -70,7 +70,7 @@ in { packages = forAllSystems (system: let pkgs-ovl = pkgsForSystem system; - pkgs = nixpkgsFor.${system}; + pkgs-nix = nixpkgsFor.${system}; in with pkgs-ovl; { default = stdenv.mkDerivation { @@ -82,7 +82,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 @@ -92,7 +92,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; @@ -100,7 +103,7 @@ inherit installPhase; inherit postInstall; }; - spine-overlay-dmd = stdenv.mkDerivation { + spine-nixpkgs-dmd = stdenv.mkDerivation { inherit pname; inherit version; meta.mainProgram = "spine-dmd"; @@ -108,11 +111,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; @@ -120,7 +126,7 @@ inherit installPhase; inherit postInstall; }; - spine-overlay-ldc = stdenv.mkDerivation { + spine-nixpkgs-ldc = stdenv.mkDerivation { inherit pname; inherit version; meta.mainProgram = "spine-ldc"; @@ -128,11 +134,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; @@ -140,7 +172,7 @@ inherit installPhase; inherit postInstall; }; - spine-nixpkgs-ldc = stdenv.mkDerivation { + spine-overlay-ldc = stdenv.mkDerivation { inherit pname; inherit version; meta.mainProgram = "spine-ldc"; @@ -148,11 +180,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; @@ -190,7 +225,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"` @@ -201,8 +236,6 @@ name = "spine base dev shell"; inherit shell; inherit devEnv; - #buildInputs = [ sqlite ]; - #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ ldc #dmd @@ -212,12 +245,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 @@ -230,8 +285,6 @@ name = "spine base dev shell"; inherit shell; inherit devEnv; - #buildInputs = [ sqlite ]; - #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ ldc dub @@ -325,7 +378,7 @@ ]; inherit shellHook; }; - default = import ./shell.nix {inherit pkgs;}; + default = import ./shell.nix {inherit pkgs-nix;}; }); }; } @@ -338,8 +391,8 @@ #+HEADER: :shebang "#!/usr/bin/env -S nix-shell --pure\n#!nix-shell -i bash" #+HEADER: :noweb yes #+BEGIN_SRC nix -{pkgs ? import {}}: -with pkgs; +{pkgs-nix ? import {}}: +with pkgs-nix; mkShell { buildInputs = [ # ❯❯❯ nix_related @@ -351,16 +404,17 @@ with pkgs; nix-output-monitor nix-tree jq #gx - alejandra + #alejandra git # ❯❯❯ dev gnumake ps # ❯❯❯ d_build_related # ❯❯ package manager - dub + #dub # ❯❯ compiler - ldc + #dmd + #ldc #rund # ❯❯ linker #lld @@ -369,7 +423,7 @@ with pkgs; #ninja #meson # ❯❯❯ sqlite search related - sqlite + #sqlite # ❯❯❯ pdf_latex_related # source-sans-pro # source-serif-pro @@ -426,7 +480,7 @@ with pkgs; nix-output-monitor nix-tree jq #gx - alejandra + #alejandra git # ❯❯❯ dev gnumake @@ -435,6 +489,7 @@ with pkgs; # ❯❯ package manager dub # ❯❯ compiler + #dmd ldc # ❯❯❯ sqlite search related sqlite @@ -653,7 +708,6 @@ github:nixos/nixpkgs - nix build ".#default" --print-build-logs - nix build ".#spine-dmd" --print-build-logs - nix build ".#spine-ldc" --print-build-logs -- nix build ".#spine-gdc" --print-build-logs - nix develop - nix develop ".#devShell" --print-build-logs diff --git a/shell.nix b/shell.nix index d90aa6c..4093de6 100755 --- a/shell.nix +++ b/shell.nix @@ -1,7 +1,7 @@ #!/usr/bin/env -S nix-shell --pure #!nix-shell -i bash -{pkgs ? import {}}: -with pkgs; +{pkgs-nix ? import {}}: +with pkgs-nix; mkShell { buildInputs = [ # ❯❯❯ nix_related @@ -13,16 +13,17 @@ with pkgs; nix-output-monitor nix-tree jq #gx - alejandra + #alejandra git # ❯❯❯ dev gnumake ps # ❯❯❯ d_build_related # ❯❯ package manager - dub + #dub # ❯❯ compiler - ldc + #dmd + #ldc #rund # ❯❯ linker #lld @@ -31,7 +32,7 @@ with pkgs; #ninja #meson # ❯❯❯ sqlite search related - sqlite + #sqlite # ❯❯❯ pdf_latex_related # source-sans-pro # source-serif-pro -- cgit v1.2.3