diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2023-01-27 14:02:44 -0500 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2023-01-27 23:23:32 -0500 |
commit | 2dd7bcc4e0a068ab2ad56b38775b2fe7d094e724 (patch) | |
tree | 98833e184c204e3d4b9bf87f139a50e7a7d787d8 | |
parent | nix & build housekeeping (diff) |
nix flake & build, devShells etc.
-rw-r--r-- | .env/echo-nixNote | 113 | ||||
-rw-r--r-- | .env/local | 1 | ||||
-rw-r--r-- | .envrc | 44 | ||||
-rw-r--r-- | .envrc-local_ | 16 | ||||
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | flake.lock | 6 | ||||
-rw-r--r-- | flake.nix | 77 | ||||
-rw-r--r-- | org/config_git.org | 24 | ||||
-rw-r--r-- | org/config_nix.org | 207 | ||||
-rwxr-xr-x | shell.nix | 1 |
10 files changed, 309 insertions, 182 deletions
diff --git a/.env/echo-nixNote b/.env/echo-nixNote new file mode 100644 index 0000000..7c8226d --- /dev/null +++ b/.env/echo-nixNote @@ -0,0 +1,113 @@ +echo '-*- mode: org -*- + +* nixpkgs path? + + # eval "$(nix print-dev-env)" +' > nixNote_.org + +echo " <nixpkgs> == `nix-instantiate --find-file nixpkgs`" >> nixNote_.org + +echo ' +* nix build and show derivation + +#+BEGIN_SRC sh +nix-shell --pure + +nix-build +nix build -f default.nix --print-build-logs +nix shell -f default.nix --print-build-logs +nix develop --build -f derivation.nix -I .envrc --print-build-logs +nix-instantiate | nix-build +nix build `nix-instantiate` + +nix develop + +nix-instantiate | nix show-derivation | jq +nix-instantiate | nix show-derivation --recursive | jq + +nix search --json 2>/dev/null |jq +#+END_SRC + +* version and build info + +#+BEGIN_SRC sh' >> nixNote_.org + +echo 'spine version (git) == $SpineVER' >> nixNote_.org +echo "spine version (git) == $SpineVER" >> nixNote_.org +echo 'nix-instantiate == `nix-instantiate`' >> nixNote_.org +echo "nix-instantiate == `nix-instantiate`" >> nixNote_.org + +echo "#+END_SRC + +* initialised shell variables + +#+BEGIN_SRC sh +SpineSRC=$SpineSRC +SpineBIN=$SpineBIN +SpineDOC=$SpineDOC +SpinePOD=$SpinePOD +#SpineOUTversioned=$SpineOUTversioned +SpineOUT=$SpineOUT +SpineCgiBIN=$SpineCgiBIN +#+END_SRC +" >> nixNote_.org + +echo '* cgi form spine_search nix build and copy to spine-search + +#+BEGIN_SRC sh +nix-build && sudo cp -vi result/share/cgi-bin/spine_search $SpineCgiBIN/. +#+END_SRC + +* spine run instruction examples +** cgi operations (output to $SpineOUT) +*** configuration + +#+BEGIN_SRC sh +$SpineBIN/spine -v --show-config --config=$SpinePOD/.dr +#+END_SRC + +*** generate html (linked to search form & curate) + +#+BEGIN_SRC sh +$SpineBIN/spine -v --html --html-link-search --html-link-curate --sqlite-db-filename="spine.search.db" --cgi-sqlite-search-filename="spine_search"--output=$SpineOUT $SpinePOD/* +#+END_SRC + +*** generate sql output + +#+BEGIN_SRC sh +SpineBIN/spine -v --sqlite-update --sqlite-db-filename="spine.search.db" --sqlite-db-path="$SpineDBpath" +#+END_SRC + +*** generate curate + +#+BEGIN_SRC sh +$SpineBIN/spine -v --curate --output=$SpineOUT $SpinePOD/* +$SpineBIN/spine -v --html --html-link-curate --curate --output=$SpineOUT $SpinePOD/* +#+END_SRC + +*** create or re-create sql db (--sqlite-db-create or --sqlite-db-recreate) + +#+BEGIN_SRC sh +$SpineBIN/spine -v --sqlite-db-recreate --sqlite-db-filename="spine.search.db" --sqlite-db-path="$SpineDBpath" +#+END_SRC + +*** generate html (linked to search form), sql output, curate + +#+BEGIN_SRC sh +$SpineBIN/spine -v --html --html-link-search --html-link-curate --curate --sqlite-db-filename="spine.search.db" --cgi-sqlite-search-filename="spine_search" --sqlite-update --sqlite-db-path="$SpineDBpath" --output="$SpineOUT" $SpinePOD/* +#if names and paths are configured in resource configuration file, e.g. $SpinePOD/.rc/config_local_site +$SpineBIN/spine -v --html --html-link-search --html-link-curate --curate --sqlite-update $SpinePOD/* +#+END_SRC + +*** make search form + +#+BEGIN_SRC sh +$SpineBIN/spine -v --cgi-search-form-codegen --config=$SpinePOD/.dr/config_local_site +#$SpineBIN/spine -v --cgi-search-form-codegen --output=$SpineOUT $SpinePOD/* +#+END_SRC +' >> nixNote_.org + +#cat nixNote_.org + +#echo "emacs nixNote_.org" +#echo "cat nixNote_.org" diff --git a/.env/local b/.env/local new file mode 100644 index 0000000..8c18a87 --- /dev/null +++ b/.env/local @@ -0,0 +1 @@ +export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos @@ -1,34 +1,34 @@ use flake . #use flake .#default NIX_ENFORCE_PURITY=1 -NixDirEnvVersion="2.2.0" +NixDirEnvVersion="2.2.1" if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then # - https://github.com/nix-community/nix-direnv # 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=" + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs=" fi watch_file flake.lock watch_file flake.nix -nix flake update && nix flake check --show-trace && nix flake show +#nix flake update && nix flake check --show-trace && nix flake show if [ -f .envrc-local ]; then source_env_if_exists .envrc-local || source .envrc-local fi -echo " - -- nix flake update && nix flake check --show-trace && nix flake show && nix develop .#devShell - -- nix build .#default --print-build-logs -- nix build .#spine-search-ldc --print-build-logs -- nix build .#spine-search-dmd --print-build-logs -- nix build .#spine-search-gdc --print-build-logs - -nix-shell '<nixpkgs>' -A nix --pure - -nix run .#default --print-build-logs - -nix develop --build .#default --print-build-logs - -nix shell .#default --print-build-logs --command spine -v -nix shell .#default --print-build-logs --command spine --very-verbose --epub --html --html-link-search --html-link-curate --curate --output=\"\$SpineOUT\" ./markup/pod -nix shell .#default --print-build-logs --command spine --very-verbose --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename=\"spine.search.db\" --cgi-sqlite-search-filename=\"spine_search\" --sqlite-db-path=\"\$SpineDBpath\" --output=\"\$SpineOUT\" ./markup/pod -" +# echo " +# +# - nix flake update && nix flake check --show-trace && nix flake show && nix develop .#devShell +# +# - nix build .#default --print-build-logs +# - nix build .#spine-search-ldc --print-build-logs +# - nix build .#spine-search-dmd --print-build-logs +# - nix build .#spine-search-gdc --print-build-logs +# +# nix-shell '<nixpkgs>' -A nix --pure +# +# nix run .#default --print-build-logs +# +# nix develop --build .#default --print-build-logs +# +# nix shell .#default --print-build-logs --command spine -v +# nix shell .#default --print-build-logs --command spine --very-verbose --epub --html --html-link-search --html-link-curate --curate --output=\"\$SpineOUT\" ./markup/pod +# nix shell .#default --print-build-logs --command spine --very-verbose --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename=\"spine.search.db\" --cgi-sqlite-search-filename=\"spine_search\" --sqlite-db-path=\"\$SpineDBpath\" --output=\"\$SpineOUT\" ./markup/pod +# " diff --git a/.envrc-local_ b/.envrc-local_ index 7fc8556..8b458d8 100644 --- a/.envrc-local_ +++ b/.envrc-local_ @@ -1,17 +1,13 @@ -export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos +#export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos +#export NIX_PATH=/srv/nix/nixpkgs #export NIX_PATH=nixpkgs=/srv/nix/nixpkgs export DFLAGS="-O2 -inline -boundscheck=on -color=on" -## load the flake devShell -# eval "$(nix print-dev-env)" -# echo $NIX_BUILD_TOP -export Date=`date "+%Y%m%d"` export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g') export SpinePROJ=~/grotto/repo/git.repo/projects/doc-reform/code/software/spine-search -export SpineSRC=$SpinePROJ/src -#export SpineBIN=$SpinePROJ/result/bin export SpineDOC=~/grotto/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples -export SpinePOD=$SpineDOC/markup/pod -#export SpineOUTversioned=/srv/www/spine/$SpineVER export SpineOUT=/srv/www/spine export SpineDBpath=/var/www/sqlite -export SpineCgiBIN=/var/www/cgi/cgi-bin +#export SpineDBpath=/srv/www/spine/sqlite +export SpineCGIbin=/var/www/cgi/cgi-bin +export SpineCGIform='spine_search' +export SpineSQLdb='spine.search.db' @@ -10,6 +10,8 @@ !*.nix !flake.lock !.envrc +!.env +!.env/** !README.md !README !COPYRIGHT @@ -17,11 +17,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1674487464, - "narHash": "sha256-Jgq50e4S4JVCYpWLqrabBzDp/1mfaxHCh8/OOorHTy0=", + "lastModified": 1674807565, + "narHash": "sha256-zOLE1YXf2RhYhtNv4n8C0xPaSjduchLlCxZaAeoAvxU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3954218cf613eba8e0dcefa9abe337d26bc48fd0", + "rev": "f80ac848e3d6f0c12c52758c0f25c10c97ca3b62", "type": "github" }, "original": { @@ -2,12 +2,12 @@ description = "a sisu like document parser search form"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; # "github:nixos/nixpkgs"; "github:NixOS/nixpkgs/nixpkgs-unstable"; "nixpkgs/nixos-unstable"; "nixpkgs/nixos-21.11"; inputs.flake-utils.url = "github:numtide/flake-utils"; - outputs = { self, nixpkgs, flake-utils }: + outputs = { self, nixpkgs, flake-utils } @inputs: let pname = "spine_search"; version = "0.12.0"; shell = ./shell.nix; # ./default.nix; - devEnv = ./shell.nix; # ./default.nix; + devEnv = ./.envrc; # ./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. @@ -24,24 +24,6 @@ ''; 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: @@ -130,12 +112,57 @@ inherit postInstall; }; #vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000="; - }); + }); devShells = forAllSystems (system: - let pkgs = nixpkgsFor.${system}; + let + pkgs = nixpkgsFor.${system}; + shellHook = '' + export DFLAGS="-O2 -inline -boundscheck=on -color=on" + export Date=`date "+%Y%m%d"` + export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g') + ### set local values in .envrc-local (or modify here if you must) + # export SpinePROJ=~/grotto/repo/git.repo/projects/doc-reform/code/software/spine + # export SpineDOC=~/grotto/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples + # export SpineOUT=/srv/www/spine + export SpineDBpath=/var/www/sqlite + # export SpineDBpath=/srv/www/spine/sqlite + export SpineSRC=$SpinePROJ/src + export SpineBIN=$SpinePROJ/result/bin + export SpinePOD=$SpineDOC/markup/pod + export SpineSearchActionLocal='http://localhost/spine_search' + # export SpineSearchActionRemote='https://sisudoc.org/spine_search' + export SpineCGIform='spine_search' + export SpineSQLdb='spine.search.db' + export PROG_VER_GIT="`git describe --long --tags | sed -e 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g'`" + export spineNixHelp="cat ./.env/nix-commands" + export spineHtml="spine --very-verbose --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename=\"spine.search.db\" --cgi-sqlite-search-filename=\"spine_search\" --sqlite-db-path=\"\$SpineDBpath\" --output=\"\$SpineOUT\" $SpinePOD/*" + export spineSqliteCreateDB="spine --very-verbose --sqlite-db-recreate --sqlite-db-path=\"$SpineDBpath\" --sqlite-db-filename=\"spine.search.db\"" + export spineSqlite="spine --very-verbose --sqlite-discrete --sqlite-db-path=\"$SpineDBpath\" --sqlite-db-filename=\"spine.search.db\" --output=\"\$SpineOUT\" $SpinePOD/*" + #export spineSqlite="spine --very-verbose --sqlite-update --sqlite-db-path=\"$SpineDBpath\" --sqlite-db-filename=\"spine.search.db\" --output=\"\$SpineOUT\" $SpinePOD/*" + ''; in with pkgs; { - devShell = mkShell { }; - #devShell = mkShell { buildInputs = [ git dub dmd ldc gdc sqlite ]; }; - }); + devShell = mkShell rec { + name = "spine dev shell default"; + inherit shell; + inherit devEnv; + #buildInputs = [ sqlite ]; + #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; + packages = [ + sqlite + dub dmd ldc gdc gnumake + ]; + inherit shellHook; + }; + devShell-sqlite = mkShell rec { + name = "spine dev shell for latex & pdf output"; + inherit shell; + inherit devEnv; + packages = [ + sqlite + dub dmd ldc gdc gnumake + ]; + inherit shellHook; + }; + }); }; } diff --git a/org/config_git.org b/org/config_git.org index 7842340..460b91d 100644 --- a/org/config_git.org +++ b/org/config_git.org @@ -25,13 +25,15 @@ # git clean -ix # find . -name "*_" | xargs rm -rf # find . -name "*.o" | xargs rm -rf -* +,* !.gitignore !.gitattributes !nix/** !*.nix !flake.lock !.envrc +!.env +!.env/** !README.md !README !COPYRIGHT @@ -58,18 +60,18 @@ !config_local_site !views .dub/** -**/.dub/** -**/cgi-bin/** +,**/.dub/** +,**/cgi-bin/** tmp/** -*_.org -*_.nix -*_.d -*_.txt -*_ -*.swp -*~ +,*_.org +,*_.nix +,*_.d +,*_.txt +,*_ +,*.swp +,*~ \#* -*.\#* +,*.\#* !.envrc-local_ !src/spine_search.d_ #!*/ diff --git a/org/config_nix.org b/org/config_nix.org index 9af553c..5950ee9 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -81,37 +81,37 @@ nix show-derivation /nix/store/q7n14bm8j5vzm62qaraczdb4bpyf59vv-spine-0.11.1.drv use flake . #use flake .#default NIX_ENFORCE_PURITY=1 -NixDirEnvVersion="2.2.0" +NixDirEnvVersion="2.2.1" if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then # - https://github.com/nix-community/nix-direnv # 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=" + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs=" fi watch_file flake.lock watch_file flake.nix -nix flake update && nix flake check --show-trace && nix flake show +#nix flake update && nix flake check --show-trace && nix flake show if [ -f .envrc-local ]; then source_env_if_exists .envrc-local || source .envrc-local fi -echo " - -- nix flake update && nix flake check --show-trace && nix flake show && nix develop .#devShell - -- nix build .#default --print-build-logs -- nix build .#spine-search-ldc --print-build-logs -- nix build .#spine-search-dmd --print-build-logs -- nix build .#spine-search-gdc --print-build-logs - -nix-shell '<nixpkgs>' -A nix --pure - -nix run .#default --print-build-logs - -nix develop --build .#default --print-build-logs - -nix shell .#default --print-build-logs --command spine -v -nix shell .#default --print-build-logs --command spine --very-verbose --epub --html --html-link-search --html-link-curate --curate --output=\"\$SpineOUT\" ./markup/pod -nix shell .#default --print-build-logs --command spine --very-verbose --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename=\"spine.search.db\" --cgi-sqlite-search-filename=\"spine_search\" --sqlite-db-path=\"\$SpineDBpath\" --output=\"\$SpineOUT\" ./markup/pod -" +# echo " +# +# - nix flake update && nix flake check --show-trace && nix flake show && nix develop .#devShell +# +# - nix build .#default --print-build-logs +# - nix build .#spine-search-ldc --print-build-logs +# - nix build .#spine-search-dmd --print-build-logs +# - nix build .#spine-search-gdc --print-build-logs +# +# nix-shell '<nixpkgs>' -A nix --pure +# +# nix run .#default --print-build-logs +# +# nix develop --build .#default --print-build-logs +# +# nix shell .#default --print-build-logs --command spine -v +# nix shell .#default --print-build-logs --command spine --very-verbose --epub --html --html-link-search --html-link-curate --curate --output=\"\$SpineOUT\" ./markup/pod +# nix shell .#default --print-build-logs --command spine --very-verbose --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename=\"spine.search.db\" --cgi-sqlite-search-filename=\"spine_search\" --sqlite-db-path=\"\$SpineDBpath\" --output=\"\$SpineOUT\" ./markup/pod +# " #+END_SRC **** .envrc-local CHECK MODIFY @@ -121,23 +121,19 @@ nix shell .#default --print-build-logs --command spine --very-verbose --html --h #+HEADER: :tangle ../.envrc-local_ #+HEADER: :noweb yes #+BEGIN_SRC sh -export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos +#export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos +#export NIX_PATH=/srv/nix/nixpkgs #export NIX_PATH=nixpkgs=/srv/nix/nixpkgs export DFLAGS="-O2 -inline -boundscheck=on -color=on" -## load the flake devShell -# eval "$(nix print-dev-env)" -# echo $NIX_BUILD_TOP -export Date=`date "+%Y%m%d"` export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g') export SpinePROJ=~/grotto/repo/git.repo/projects/doc-reform/code/software/spine-search -export SpineSRC=$SpinePROJ/src -#export SpineBIN=$SpinePROJ/result/bin export SpineDOC=~/grotto/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples -export SpinePOD=$SpineDOC/markup/pod -#export SpineOUTversioned=/srv/www/spine/$SpineVER export SpineOUT=/srv/www/spine export SpineDBpath=/var/www/sqlite -export SpineCgiBIN=/var/www/cgi/cgi-bin +#export SpineDBpath=/srv/www/spine/sqlite +export SpineCGIbin=/var/www/cgi/cgi-bin +export SpineCGIform='spine_search' +export SpineSQLdb='spine.search.db' #+END_SRC *** makefile @@ -188,16 +184,29 @@ postInstall: description = "a sisu like document parser search form"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; # "github:nixos/nixpkgs"; "github:NixOS/nixpkgs/nixpkgs-unstable"; "nixpkgs/nixos-unstable"; "nixpkgs/nixos-21.11"; inputs.flake-utils.url = "github:numtide/flake-utils"; - outputs = { self, nixpkgs, flake-utils }: + outputs = { self, nixpkgs, flake-utils } @inputs: let pname = "spine_search"; version = "<<spine_version_set>>"; shell = ./shell.nix; # ./default.nix; - devEnv = ./shell.nix; # ./default.nix; + devEnv = ./.envrc; # ./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>> + 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` + ''; in { packages = forAllSystems (system: let pkgs = nixpkgsFor.${system}; @@ -285,81 +294,57 @@ postInstall: inherit postInstall; }; #vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000="; - }); + }); devShells = forAllSystems (system: - let pkgs = nixpkgsFor.${system}; - in with pkgs; { - devShell = mkShell { }; - #devShell = mkShell { buildInputs = [ git dub dmd ldc gdc sqlite ]; }; - }); - }; -} -#+END_SRC - -**** flakes -***** flake single system - -#+NAME: flake_single_sytem -#+HEADER: :noweb yes -#+BEGIN_SRC nix -{ - description = "a sisu like document parser search form"; - inputs.<<flake_inputs_nix>> - outputs = { <<flake_outputs>> }: { - packages.x86_64-linux.spine_search = - let - pkgs = import nixpkgs { - system = "x86_64-linux"; - }; - #targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; - in pkgs.stdenv.mkDerivation { - <<flake_metadata>> - inherit self; - src = self; - #shell = ./shell.nix; - shell = ./default.nix; - devEnv = ./devenv.nix; - <<flake_phases>> - buildInputs = [ sqlite ]; - nativeBuildInputs = with pkgs; [ dub ldc ]; - }; - packages.x86_64-linux.default = self.packages.x86_64-linux.spine_search; - }; -} -#+END_SRC - -***** flake (multi-system) - -#+NAME: flake_multi_system_possible -#+HEADER: :noweb yes -#+BEGIN_SRC nix -{ - description = "a sisu like document parser search form"; - inputs.<<flake_inputs_nix>> - outputs = { <<flake_outputs>> }: - let - version = "<<spine_version_set>>"; - supportedSystems = [ "x86_64-linux" ]; # [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; - # helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. - forAllSystems = nixpkgs.lib.genAttrs supportedSystems; - nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); # nixpkgs instantiated for supported system types. - <<flake_devshells>> - in { - packages = forAllSystems (system: let - pkgs = nixpkgsFor.${system}; - in { - default = pkgs.stdenv.mkDerivation { - pname = "spine_search"; - inherit version; - src = self; - shell = ./default.nix; - devEnv = ./devenv.nix; - buildInputs = [ sqlite ]; - nativeBuildInputs = with pkgs; [ dub ldc ]; # [ dub dmd ]; [ dub ldc ]; [ dub gdc ]; - <<flake_phases>> + pkgs = nixpkgsFor.${system}; + shellHook = '' + export DFLAGS="-O2 -inline -boundscheck=on -color=on" + export Date=`date "+%Y%m%d"` + export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g') + ### set local values in .envrc-local (or modify here if you must) + # export SpinePROJ=~/grotto/repo/git.repo/projects/doc-reform/code/software/spine + # export SpineDOC=~/grotto/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples + # export SpineOUT=/srv/www/spine + export SpineDBpath=/var/www/sqlite + # export SpineDBpath=/srv/www/spine/sqlite + export SpineSRC=$SpinePROJ/src + export SpineBIN=$SpinePROJ/result/bin + export SpinePOD=$SpineDOC/markup/pod + export SpineSearchActionLocal='http://localhost/spine_search' + # export SpineSearchActionRemote='https://sisudoc.org/spine_search' + export SpineCGIform='spine_search' + export SpineSQLdb='spine.search.db' + export PROG_VER_GIT="`git describe --long --tags | sed -e 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g'`" + export spineNixHelp="cat ./.env/nix-commands" + export spineHtml="spine --very-verbose --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename=\"spine.search.db\" --cgi-sqlite-search-filename=\"spine_search\" --sqlite-db-path=\"\$SpineDBpath\" --output=\"\$SpineOUT\" $SpinePOD/*" + export spineSqliteCreateDB="spine --very-verbose --sqlite-db-recreate --sqlite-db-path=\"$SpineDBpath\" --sqlite-db-filename=\"spine.search.db\"" + export spineSqlite="spine --very-verbose --sqlite-discrete --sqlite-db-path=\"$SpineDBpath\" --sqlite-db-filename=\"spine.search.db\" --output=\"\$SpineOUT\" $SpinePOD/*" + #export spineSqlite="spine --very-verbose --sqlite-update --sqlite-db-path=\"$SpineDBpath\" --sqlite-db-filename=\"spine.search.db\" --output=\"\$SpineOUT\" $SpinePOD/*" + ''; + in with pkgs; { + devShell = mkShell rec { + name = "spine dev shell default"; + inherit shell; + inherit devEnv; + #buildInputs = [ sqlite ]; + #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; + packages = [ + sqlite + dub dmd ldc gdc gnumake + ]; + inherit shellHook; + }; + devShell-sqlite = mkShell rec { + name = "spine dev shell for latex & pdf output"; + inherit shell; + inherit devEnv; + packages = [ + sqlite + dub dmd ldc gdc gnumake + ]; + inherit shellHook; }; - #vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000="; }); }; } @@ -403,7 +388,6 @@ postInstall: #nix develop #nix build .#default --print-build-logs - #+BEGIN_SRC nix src = fetchTarball { url = "file:///[path]/$(pname)-$(version).tar.gz"; @@ -446,11 +430,11 @@ self, nixpkgs, flake-utils #+NAME: flake_devshells #+HEADER: :noweb yes #+BEGIN_SRC nix -devShells = forAllSystems (system: - let pkgs = nixpkgsFor.${system}; +devShells = forAllSystems (system: + let pkgs = nixpkgsFor.${system}; in { default = pkgs.mkShell { - buildInputs = with pkgs; [ git dub dmd ldc sqlite ]; + buildInputs = with pkgs; [ git dub dmd ldc sqlite ]; }; }); #+END_SRC @@ -531,6 +515,7 @@ mkShell { validatePkgConfig nix-tree jq nix-output-monitor git + gnumake ps ### d_build_related dub @@ -10,6 +10,7 @@ mkShell { validatePkgConfig nix-tree jq nix-output-monitor git + gnumake ps ### d_build_related dub |