From 3f88e14031e46eb45b7842d9e806bce588c4f93f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 24 Jan 2023 19:08:13 -0500 Subject: nix & build housekeeping --- flake.nix | 184 ++++++++++++++++++-------------------------------------------- 1 file changed, 54 insertions(+), 130 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index b8a023e..72a8e05 100644 --- a/flake.nix +++ b/flake.nix @@ -6,9 +6,43 @@ let pname = "spine_search"; version = "0.12.0"; + shell = ./shell.nix; # ./default.nix; + devEnv = ./shell.nix; # ./default.nix; supportedSystems = [ "x86_64-linux" ]; # [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); # nixpkgs instantiated for supported system types. + checkPhase = '' + runHook preCheck + dub test --combined --skip-registry=all + runHook postCheck + ''; + installPhase = '' + runHook preInstall + mkdir -p $out/share/cgi-bin + install -m755 -D ./cgi-bin/spine_search $out/share/cgi-bin/spine_search + runHook postInstall + ''; + postInstall = '' + echo `ls -la $out/share/cgi-bin/spine_search` + echo " + nix build or nix develop? (suggestions): + - nix build + nix build .#default --print-build-logs + nix flake update; nix build .#default --print-build-logs + nix build --print-build-logs + - nix run + nix run .#default --print-build-logs + nix run default.nix --print-build-logs + - nix shell + nix shell .#default --print-build-logs --command spine -v + - nix develop + nix develop --profile .#default --print-build-logs --command spine -v + nix develop ; eval \"$buildPhase\" + nix develop --build -f derivation.nix -I .envrc --print-build-logs + - nix profile install . --print-build-logs + nix-instantiate | nix show-derivation | jq + " + ''; in { packages = forAllSystems (system: let pkgs = nixpkgsFor.${system}; @@ -18,8 +52,8 @@ inherit version; executable = true; src = self; - shell = ./default.nix; - devEnv = ./devenv.nix; + inherit shell; + inherit devEnv; buildInputs = [ sqlite ]; nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; # [ dub dmd ]; [ dub ldc ]; [ dub gdc ]; buildPhase = '' @@ -34,38 +68,9 @@ dub build --compiler=$DC --build=$DC_ --combined --skip-registry=all runHook postBuild ''; - checkPhase = '' - runHook preCheck - dub test --combined --skip-registry=all - runHook postCheck - ''; - installPhase = '' - runHook preInstall - mkdir -p $out/share/cgi-bin - install -m755 -D ./cgi-bin/spine_search $out/share/cgi-bin/spine_search - runHook postInstall - ''; - postInstall = '' - echo `ls -la $out/share/cgi-bin/spine_search` - echo " - nix build or nix develop? (suggestions): - - nix build - nix build .#default --print-build-logs - nix flake update; nix build .#default --print-build-logs - nix build --print-build-logs - - nix run - nix run .#default --print-build-logs - nix run default.nix --print-build-logs - - nix shell - nix shell .#default --print-build-logs --command spine -v - - nix develop - nix develop --profile .#default --print-build-logs --command spine -v - nix develop ; eval \"$buildPhase\" - nix develop --build -f derivation.nix -I .envrc --print-build-logs - - nix profile install . --print-build-logs - nix-instantiate | nix show-derivation | jq - " - ''; + inherit checkPhase; + inherit installPhase; + inherit postInstall; }; spine-search-dmd = stdenv.mkDerivation { inherit pname; @@ -73,6 +78,8 @@ meta.mainProgram = "spine_search-dmd"; executable = true; src = self; + inherit shell; + inherit devEnv; buildInputs = [ sqlite ]; nativeBuildInputs = [ dub dmd gnumake ]; buildPhase = '' @@ -80,38 +87,9 @@ dub build --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all runHook postBuild ''; - checkPhase = '' - runHook preCheck - dub test --combined --skip-registry=all - runHook postCheck - ''; - installPhase = '' - runHook preInstall - mkdir -p $out/share/cgi-bin - install -m755 -D ./cgi-bin/spine_search $out/share/cgi-bin/spine_search - runHook postInstall - ''; - postInstall = '' - echo `ls -la $out/share/cgi-bin/spine_search` - echo " - nix build or nix develop? (suggestions): - - nix build - nix build .#default --print-build-logs - nix flake update; nix build .#default --print-build-logs - nix build --print-build-logs - - nix run - nix run .#default --print-build-logs - nix run default.nix --print-build-logs - - nix shell - nix shell .#default --print-build-logs --command spine -v - - nix develop - nix develop --profile .#default --print-build-logs --command spine -v - nix develop ; eval \"$buildPhase\" - nix develop --build -f derivation.nix -I .envrc --print-build-logs - - nix profile install . --print-build-logs - nix-instantiate | nix show-derivation | jq - " - ''; + inherit checkPhase; + inherit installPhase; + inherit postInstall; }; spine-search-ldc = stdenv.mkDerivation { inherit pname; @@ -119,6 +97,8 @@ meta.mainProgram = "spine_search-ldc"; executable = true; src = self; + inherit shell; + inherit devEnv; buildInputs = [ sqlite ]; nativeBuildInputs = [ dub ldc gnumake ]; buildPhase = '' @@ -126,38 +106,9 @@ dub build --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all runHook postBuild ''; - checkPhase = '' - runHook preCheck - dub test --combined --skip-registry=all - runHook postCheck - ''; - installPhase = '' - runHook preInstall - mkdir -p $out/share/cgi-bin - install -m755 -D ./cgi-bin/spine_search $out/share/cgi-bin/spine_search - runHook postInstall - ''; - postInstall = '' - echo `ls -la $out/share/cgi-bin/spine_search` - echo " - nix build or nix develop? (suggestions): - - nix build - nix build .#default --print-build-logs - nix flake update; nix build .#default --print-build-logs - nix build --print-build-logs - - nix run - nix run .#default --print-build-logs - nix run default.nix --print-build-logs - - nix shell - nix shell .#default --print-build-logs --command spine -v - - nix develop - nix develop --profile .#default --print-build-logs --command spine -v - nix develop ; eval \"$buildPhase\" - nix develop --build -f derivation.nix -I .envrc --print-build-logs - - nix profile install . --print-build-logs - nix-instantiate | nix show-derivation | jq - " - ''; + inherit checkPhase; + inherit installPhase; + inherit postInstall; }; spine-search-gdc = stdenv.mkDerivation { inherit pname; @@ -165,6 +116,8 @@ meta.mainProgram = "spine_search-gdc"; executable = true; src = self; + inherit shell; + inherit devEnv; buildInputs = [ sqlite ]; nativeBuildInputs = [ dub gdc gnumake ]; buildPhase = '' @@ -172,38 +125,9 @@ dub build --compiler=$(type -P gdc) --build=gdc --combined --skip-registry=all runHook postBuild ''; - checkPhase = '' - runHook preCheck - dub test --combined --skip-registry=all - runHook postCheck - ''; - installPhase = '' - runHook preInstall - mkdir -p $out/share/cgi-bin - install -m755 -D ./cgi-bin/spine_search $out/share/cgi-bin/spine_search - runHook postInstall - ''; - postInstall = '' - echo `ls -la $out/share/cgi-bin/spine_search` - echo " - nix build or nix develop? (suggestions): - - nix build - nix build .#default --print-build-logs - nix flake update; nix build .#default --print-build-logs - nix build --print-build-logs - - nix run - nix run .#default --print-build-logs - nix run default.nix --print-build-logs - - nix shell - nix shell .#default --print-build-logs --command spine -v - - nix develop - nix develop --profile .#default --print-build-logs --command spine -v - nix develop ; eval \"$buildPhase\" - nix develop --build -f derivation.nix -I .envrc --print-build-logs - - nix profile install . --print-build-logs - nix-instantiate | nix show-derivation | jq - " - ''; + inherit checkPhase; + inherit installPhase; + inherit postInstall; }; #vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000="; }); -- cgit v1.2.3