summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.envrc1
-rw-r--r--flake.nix184
-rw-r--r--makefile24
-rw-r--r--org/config_make.org41
-rw-r--r--org/config_nix.org30
5 files changed, 127 insertions, 153 deletions
diff --git a/.envrc b/.envrc
index 954d4cd..be4d35e 100644
--- a/.envrc
+++ b/.envrc
@@ -7,7 +7,6 @@ if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then
# source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-0000000000000000000000000000000000000000000="
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-5EwyKnkJNQeXrRkYbwwRBcXbibosCJqyIUuz9Xq+LRc="
fi
-# reload when these files change
watch_file flake.lock
watch_file flake.nix
nix flake update && nix flake check --show-trace && nix flake show
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=";
});
diff --git a/makefile b/makefile
index 27e7f14..17ab590 100644
--- a/makefile
+++ b/makefile
@@ -5,14 +5,25 @@ SpineSearchAction := 'https://sisudoc.org/spine_search'
SpineCGIform := 'spine_search'
SpineSQLdb := 'spine.search.db'
+nix-devshell:
+ echo -ne "\n- nix flake update && nix flake check --show-trace && nix flake show && nix develop .#devShell\n\n- nix build .#default --print-build-logs\n- nix build .#spine-search-dmd --print-build-logs\n- nix build .#spine-search-ldc --print-build-logs\n- nix build .#spine-search-gdc --print-build-logs\n\n"; \
+ nix flake update && nix flake check --show-trace && nix flake show && nix develop .#devShell
+
# nix build
build:
nix-build
-# cp cgi search form
-cp-cgi:
- sudo cp -vi /var/www/cgi/cgi-bin/spine_search /var/www/cgi/cgi-bin/spine_search_old && \
- sudo cp -vi result/share/cgi-bin/spine_search /var/www/cgi/cgi-bin/spine_search
+nix-build-default:
+ nix build .#default --print-build-logs
+
+nix-build-dmd:
+ nix build .#spine-dmd --print-build-logs
+
+nix-build-ldc:
+ nix build .#spine-ldc --print-build-logs
+
+nix-build-gdc:
+ nix build .#spine-gdc --print-build-logs
get_depends:
hwd=$$(echo `pwd`) && \
@@ -50,3 +61,8 @@ get_depends:
set_depends: get_depends
dub describe | sed 's~$(shell echo `pwd | sed 's_/_\\/_g'`)~.~g' > dub_describe.json
+
+# cp cgi search form
+cp-cgi:
+ sudo cp -vi /var/www/cgi/cgi-bin/spine_search /var/www/cgi/cgi-bin/spine_search_old && \
+ sudo cp -vi result/share/cgi-bin/spine_search /var/www/cgi/cgi-bin/spine_search
diff --git a/org/config_make.org b/org/config_make.org
index 92e5155..4f91db4 100644
--- a/org/config_make.org
+++ b/org/config_make.org
@@ -54,15 +54,6 @@ SpineSearchAction := 'https://sisudoc.org/spine_search'
SpineCGIform := 'spine_search'
SpineSQLdb := 'spine.search.db'
-# nix build
-build:
- nix-build
-
-# cp cgi search form
-cp-cgi:
- sudo cp -vi /var/www/cgi/cgi-bin/spine_search /var/www/cgi/cgi-bin/spine_search_old && \
- sudo cp -vi result/share/cgi-bin/spine_search /var/www/cgi/cgi-bin/spine_search
-
get_depends:
hwd=$$(echo `pwd`) && \
gwd="$${hwd}/src/ext_depends" && \
@@ -657,7 +648,9 @@ gitsnapshot: distclean tangle
#+HEADER: :noweb yes
#+BEGIN_SRC makefile
<<make_cgi_search_makefile>>
+<<make_set_nix>>
<<make_get_project_cgi_search_dependencies_github>>
+<<make_copy_cgi_search>>
#+END_SRC
*** make
@@ -671,10 +664,38 @@ SpineSearchAction := 'https://sisudoc.org/spine_search'
SpineCGIform := 'spine_search'
SpineSQLdb := 'spine.search.db'
+#+END_SRC
+
+**** nix
+
+#+NAME: make_set_nix
+#+BEGIN_SRC makefile
+nix-devshell:
+ echo -ne "\n- nix flake update && nix flake check --show-trace && nix flake show && nix develop .#devShell\n\n- nix build .#default --print-build-logs\n- nix build .#spine-search-dmd --print-build-logs\n- nix build .#spine-search-ldc --print-build-logs\n- nix build .#spine-search-gdc --print-build-logs\n\n"; \
+ nix flake update && nix flake check --show-trace && nix flake show && nix develop .#devShell
+
# nix build
build:
nix-build
+nix-build-default:
+ nix build .#default --print-build-logs
+
+nix-build-dmd:
+ nix build .#spine-dmd --print-build-logs
+
+nix-build-ldc:
+ nix build .#spine-ldc --print-build-logs
+
+nix-build-gdc:
+ nix build .#spine-gdc --print-build-logs
+
+#+END_SRC
+
+**** post build copy
+
+#+NAME: make_copy_cgi_search
+#+BEGIN_SRC makefile
# cp cgi search form
cp-cgi:
sudo cp -vi /var/www/cgi/cgi-bin/spine_search /var/www/cgi/cgi-bin/spine_search_old && \
@@ -736,8 +757,6 @@ export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos
- /srv/www/spine/latex
-** make
-
** notes
- vim {the_wealth_of_networks.yochai_benkler,two_bits.christopher_kelty,viral_spiral.david_bollier}.en.a4.portrait.tex
diff --git a/org/config_nix.org b/org/config_nix.org
index 21aff72..9af553c 100644
--- a/org/config_nix.org
+++ b/org/config_nix.org
@@ -87,7 +87,6 @@ if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then
# source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-0000000000000000000000000000000000000000000="
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-5EwyKnkJNQeXrRkYbwwRBcXbibosCJqyIUuz9Xq+LRc="
fi
-# reload when these files change
watch_file flake.lock
watch_file flake.nix
nix flake update && nix flake check --show-trace && nix flake show
@@ -193,9 +192,12 @@ postInstall:
let
pname = "spine_search";
version = "<<spine_version_set>>";
+ 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.
+ <<flake_phases_other_than_buildPhase>>
in {
packages = forAllSystems (system:
let pkgs = nixpkgsFor.${system};
@@ -205,8 +207,8 @@ postInstall:
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 = ''
@@ -221,7 +223,9 @@ postInstall:
dub build --compiler=$DC --build=$DC_ --combined --skip-registry=all
runHook postBuild
'';
- <<flake_phases_other_than_buildPhase>>
+ inherit checkPhase;
+ inherit installPhase;
+ inherit postInstall;
};
spine-search-dmd = stdenv.mkDerivation {
inherit pname;
@@ -229,6 +233,8 @@ postInstall:
meta.mainProgram = "spine_search-dmd";
executable = true;
src = self;
+ inherit shell;
+ inherit devEnv;
buildInputs = [ sqlite ];
nativeBuildInputs = [ dub dmd gnumake ];
buildPhase = ''
@@ -236,7 +242,9 @@ postInstall:
dub build --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all
runHook postBuild
'';
- <<flake_phases_other_than_buildPhase>>
+ inherit checkPhase;
+ inherit installPhase;
+ inherit postInstall;
};
spine-search-ldc = stdenv.mkDerivation {
inherit pname;
@@ -244,6 +252,8 @@ postInstall:
meta.mainProgram = "spine_search-ldc";
executable = true;
src = self;
+ inherit shell;
+ inherit devEnv;
buildInputs = [ sqlite ];
nativeBuildInputs = [ dub ldc gnumake ];
buildPhase = ''
@@ -251,7 +261,9 @@ postInstall:
dub build --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all
runHook postBuild
'';
- <<flake_phases_other_than_buildPhase>>
+ inherit checkPhase;
+ inherit installPhase;
+ inherit postInstall;
};
spine-search-gdc = stdenv.mkDerivation {
inherit pname;
@@ -259,6 +271,8 @@ postInstall:
meta.mainProgram = "spine_search-gdc";
executable = true;
src = self;
+ inherit shell;
+ inherit devEnv;
buildInputs = [ sqlite ];
nativeBuildInputs = [ dub gdc gnumake ];
buildPhase = ''
@@ -266,7 +280,9 @@ postInstall:
dub build --compiler=$(type -P gdc) --build=gdc --combined --skip-registry=all
runHook postBuild
'';
- <<flake_phases_other_than_buildPhase>>
+ inherit checkPhase;
+ inherit installPhase;
+ inherit postInstall;
};
#vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000=";
});