summaryrefslogtreecommitdiffhomepage
path: root/flake.nix
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2023-01-24 19:08:13 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2023-01-26 08:31:13 -0500
commit3f88e14031e46eb45b7842d9e806bce588c4f93f (patch)
tree45081ce1e6aba798ba03d21b8703bc4f556b7638 /flake.nix
parentnix & build housekeeping, alternative D compilers (diff)
nix & build housekeeping
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix184
1 files changed, 54 insertions, 130 deletions
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=";
});