From ca590402ad0d3aefd35d51bdfc016cac9453a47c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 9 Mar 2024 20:10:02 -0500 Subject: nix flake & env upkeep --- org/config_env.org | 11 +++-- org/config_nix.org | 116 ++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 88 insertions(+), 39 deletions(-) (limited to 'org') diff --git a/org/config_env.org b/org/config_env.org index 229b404..23e2111 100644 --- a/org/config_env.org +++ b/org/config_env.org @@ -63,6 +63,7 @@ if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then fi watch_file flake.lock watch_file flake.nix +watch_file shell.nix watch_file makefile watch_file nixDevEnv.sh watch_file .envrc-local @@ -70,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 @@ -80,14 +81,18 @@ echo " ❯❯ nix develop ".#" --print-build-logs -c zsh - to build project: + ❯❯ nix build --print-build-logs + ❯❯ nix build ".#" --print-build-logs + ❯❯ nix build ".#spine-search-nixpkgs-dmd" --print-build-logs + ❯❯ nix build ".#spine-search-overlay-dmd" --print-build-logs ❯❯ nix build ".#spine-search-nixpkgs-ldc" --print-build-logs - ❯❯ nix build ".#spine-search-ovlerlay-ldc" --print-build-logs + ❯❯ nix build ".#spine-search-overlay-ldc" --print-build-logs - (see nix other/additional build options): ❯❯ nix flake show ❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" -c zsh ❯❯ dub build --compiler=ldmd --build=release --combined --skip-registry=all -" +' #+END_SRC *** 3.0.0 diff --git a/org/config_nix.org b/org/config_nix.org index 60232a6..45dcb2c 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -79,7 +79,7 @@ in { packages = forAllSystems (system: let pkgs-ovl = pkgsForSystem system; - pkgs = nixpkgsFor.${system}; + pkgs-nix = nixpkgsFor.${system}; in with pkgs-ovl; { default = stdenv.mkDerivation { @@ -100,7 +100,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; @@ -108,7 +111,7 @@ inherit installPhase; inherit postInstall; }; - spine-search-ovlerlay-dmd = stdenv.mkDerivation { + spine-search-nixpkgs-dmd = stdenv.mkDerivation { inherit pname; inherit version; meta.mainProgram = "spine_search-dmd"; @@ -116,11 +119,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; @@ -128,7 +134,7 @@ inherit installPhase; inherit postInstall; }; - spine-search-ovlerlay-ldc = stdenv.mkDerivation { + spine-search-nixpkgs-ldc = stdenv.mkDerivation { inherit pname; inherit version; meta.mainProgram = "spine_search-ldc"; @@ -136,11 +142,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-search-overlay-dmd = stdenv.mkDerivation { + inherit pname; + inherit version; + meta.mainProgram = "spine_search-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; @@ -148,7 +180,7 @@ inherit installPhase; inherit postInstall; }; - spine-search-nixpkgs-ldc = stdenv.mkDerivation { + spine-search-overlay-ldc = stdenv.mkDerivation { inherit pname; inherit version; meta.mainProgram = "spine_search-ldc"; @@ -156,11 +188,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; @@ -168,7 +203,7 @@ inherit installPhase; inherit postInstall; }; - #spine-search-ovl-gdc = stdenv.mkDerivation { + #spine-search-overlay-gdc = stdenv.mkDerivation { # inherit pname; # inherit version; # meta.mainProgram = "spine_search-gdc"; @@ -192,7 +227,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"` @@ -204,25 +239,22 @@ name = "spine base dev shell"; inherit shell; inherit devEnv; - #nativeBuildInputs = [ ldc dub gnumake ]; - #buildInputs = [ sqlite ]; packages = [ - sqlite ldc #dmd dub gnumake + sqlite ]; inherit shellHook; }; dsh-d-overlay = d-overlay.devShells.${system}.default; - dsh-sqlite = mkShell { - name = "spine dev shell for latex & pdf output"; + dsh-overlay-dmd-dub = mkShell { + name = "spine base dev shell"; inherit shell; inherit devEnv; packages = [ - ldc - #dmd + dmd dub gnumake sqlite @@ -233,17 +265,28 @@ name = "nixpkgs - ldc - dub"; inherit shell; inherit devEnv; - #nativeBuildInputs = [ ldc dub gnumake ]; - #buildInputs = [ sqlite ]; - packages = with pkgs; [ + packages = with pkgs-nix; [ + ldc + dub + gnumake + sqlite + ]; + inherit shellHook; + }; + dsh-sqlite = mkShell { + name = "spine dev shell for latex & pdf output"; + inherit shell; + inherit devEnv; + packages = [ ldc + #dmd dub gnumake sqlite ]; inherit shellHook; }; - default = import ./shell.nix {inherit pkgs;}; + default = import ./shell.nix {inherit pkgs-nix;}; }); }; } @@ -256,8 +299,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 @@ -268,17 +311,18 @@ with pkgs; validatePkgConfig nix-output-monitor nix-tree - jq - alejandra + jq #gx + #alejandra git # ❯❯❯ dev gnumake ps # ❯❯❯ d_build_related # ❯❯ package manager - dub + #dub # ❯❯ compiler - ldc + #dmd + #ldc #rund # ❯❯ linker #lld @@ -337,8 +381,8 @@ with pkgs; validatePkgConfig nix-output-monitor nix-tree - jq - alejandra + jq #gx + #alejandra git # ❯❯❯ dev gnumake @@ -473,7 +517,7 @@ with ( buildInputs = [ pkgs.sqlite ( - with pkgs; [ + with pkgs-nix; [ nixVersions.unstable #nixFlakes ## package manager dub @@ -484,7 +528,7 @@ with ( ] ) ]; - meta = with pkgs.lib; { + meta = with pkgs-nix.lib; { pname = "spine-search"; version = "<>"; homepage = "https://sisudoc.org"; -- cgit v1.2.3