From 934b830f804c1acae1e5f2f55207a1f428244f1f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 31 Jul 2022 15:44:56 -0400 Subject: org nix adjust --- .env/echo-nixNote | 13 ++- .env/local_ | 2 + .envrc | 10 +- org/config_nix.org | 191 +++++++++++++++++++++++----------- shell.nix | 45 +++++++- sundry/spine_search_cgi/.envrc | 4 +- sundry/spine_search_cgi/.envrc-local_ | 119 +-------------------- sundry/spine_search_cgi/shell.nix | 4 +- 8 files changed, 200 insertions(+), 188 deletions(-) diff --git a/.env/echo-nixNote b/.env/echo-nixNote index 6ddfe58..98449bb 100644 --- a/.env/echo-nixNote +++ b/.env/echo-nixNote @@ -13,16 +13,23 @@ echo ' #+BEGIN_SRC sh nix-shell --pure -nix-build -nix build -f default.nix -nix shell -f default.nix +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-instantiate -I .envrc | nix-build -I .envrc nix build `nix-instantiate` +nix build `nix-instantiate -I .envrc` nix develop nix-instantiate | nix show-derivation | jq +nix-instantiate -I .envrc | nix show-derivation -f derivation.nix -I .envrc | jq + nix-instantiate | nix show-derivation --recursive | jq +nix-instantiate -I .envrc | nix show-derivation -f derivation.nix --recursive -I .envrc | jq nix search --json 2>/dev/null |jq #+END_SRC diff --git a/.env/local_ b/.env/local_ index f3036c9..10216c8 100644 --- a/.env/local_ +++ b/.env/local_ @@ -1,3 +1,4 @@ +echo ".envrc called .env/local" export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos #export NIX_PATH=/nixpkgs-ra/nixpkgs export DFLAGS="-O2 -inline" @@ -23,6 +24,7 @@ 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 PROG_VER_DECLARED="`cat ./views/version.txt | grep --color=never "enum" | sed 's/.\+(\([0-9]\+\),[ \t]\+\([0-9]\+\),[ \t]\+\([0-9]\+\)[ \t]*).\+/\1.\2.\3/g'`" +direnv allow if [ -e .env/echo-nixNote ]; then source .env/echo-nixNote diff --git a/.envrc b/.envrc index c0adda9..a63ea48 100644 --- a/.envrc +++ b/.envrc @@ -1,8 +1,10 @@ NIX_ENFORCE_PURITY=0 -if ! has nix_direnv_version || ! nix_direnv_version 1.4.0; then +NixDirEnvVersion="2.1.2" +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/1.4.0/direnvrc" "sha256-4XfVDjv75eHMWN4G725VW7BoOV4Vl3vAabK4YXIfPyE=" +# 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-ytpQmMcUBR2czh8kGOqn/dmD6u55m3lDbeu/G8HGD7A=" fi -if [ -e .env/local ]; then - source_env_if_exists .env/local || source .env/local +if [ -f .envrc-local ]; then + source_env_if_exists .envrc-local || source .envrc-local fi diff --git a/org/config_nix.org b/org/config_nix.org index 0bd4f50..719c378 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -8,7 +8,7 @@ #+LANGUAGE: en #+STARTUP: content hideblocks hidestars noindent entitiespretty #+PROPERTY: header-args :exports code -#+PROPERTY: header-args+ :noweb tangle +#+PROPERTY: header-args+ :noweb yes #+PROPERTY: header-args+ :results no #+PROPERTY: header-args+ :cache no #+PROPERTY: header-args+ :padline no @@ -16,6 +16,12 @@ #+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t * nix :nix: + +#+NAME: nixpkgs_local +#+BEGIN_SRC sh +/nixpkgs-ra/nixpkgs +#+END_SRC + ** NOTES *** nix-shell @@ -39,21 +45,15 @@ nix-build project.nix #+BEGIN_SRC sh nix-shell --pure -nix-build -I nixpkgs=/nixpkgs-ra/nixpkgs -#+END_SRC - -- project.nix - -#+BEGIN_SRC sh -nix-shell --pure -nix-build -I nixpkgs=/nixpkgs-ra/nixpkgs +nix-build -I nixpkgs=<> +nix-build -I .envrc --pure #+END_SRC #+BEGIN_SRC sh -nix build -nix build -f default.nix -nix build -f project.nix -nix build -f spine.nix +nix build -f default.nix --print-build-logs +nix build -f derivation.nix --print-build-logs +nix shell -f default.nix --print-build-logs +nix develop --build -f derivation.nix -I .envrc --print-build-logs #+END_SRC *** derivation .drv @@ -73,12 +73,14 @@ nix show-derivation /nix/store/q7n14bm8j5vzm62qaraczdb4bpyf59vv-spine-0.11.1.drv #+HEADER: :tangle ../.envrc #+BEGIN_SRC sh NIX_ENFORCE_PURITY=0 -if ! has nix_direnv_version || ! nix_direnv_version 1.4.0; then +NixDirEnvVersion="2.1.2" +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/1.4.0/direnvrc" "sha256-4XfVDjv75eHMWN4G725VW7BoOV4Vl3vAabK4YXIfPyE=" +# 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-ytpQmMcUBR2czh8kGOqn/dmD6u55m3lDbeu/G8HGD7A=" fi -if [ -e .env/local ]; then - source_env_if_exists .env/local || source .env/local +if [ -f .envrc-local ]; then + source_env_if_exists .envrc-local || source .envrc-local fi #+END_SRC @@ -93,8 +95,8 @@ else # fallback prevent bootstrapping problems by using direnv's builtin nix sup use nix NIX_ENFORCE_PURITY=0 fi -if [ -e .env/local ]; then - source_env_if_exists .env/local || source .env/local +if [ -f .envrc-local ]; then + source_env_if_exists .envrc-local || source .envrc-local fi #+END_SRC @@ -124,18 +126,19 @@ else use nix NIX_ENFORCE_PURITY=0 fi - if [ -e .env/local ]; then - source_env_if_exists .env/local || source .env/local + if [ -f .envrc-local ]; then + source_env_if_exists .envrc-local || source .envrc-local fi fi #+END_SRC -**** .env/local CHECK MODIFY +**** .envrc-local CHECK MODIFY - bespoke modify appropriately and generate if needed -#+HEADER: :tangle ../.env/local_ -#+BEGIN_SRC sh +#+HEADER: :tangle ../.envrc-local_ +#+BEGIN_SRC nix +echo ".envrc called .envrc-local" export NIX_PATH=<> #export NIX_PATH=<> export DFLAGS="-O2 -inline" @@ -161,9 +164,10 @@ 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 PROG_VER_DECLARED="`cat ./views/version.txt | grep --color=never "enum" | sed 's/.\+(\([0-9]\+\),[ \t]\+\([0-9]\+\),[ \t]\+\([0-9]\+\)[ \t]*).\+/\1.\2.\3/g'`" +direnv allow -if [ -e .env/echo-nixNote ]; then - source .env/echo-nixNote +if [ -f .env/echo-nixNote ]; then + source .env/echo-nixNote fi #+END_SRC @@ -186,16 +190,23 @@ echo ' ,#+BEGIN_SRC sh nix-shell --pure -nix-build -nix build -f default.nix -nix shell -f default.nix +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-instantiate -I .envrc | nix-build -I .envrc nix build `nix-instantiate` +nix build `nix-instantiate -I .envrc` nix develop nix-instantiate | nix show-derivation | jq +nix-instantiate -I .envrc | nix show-derivation -f derivation.nix -I .envrc | jq + nix-instantiate | nix show-derivation --recursive | jq +nix-instantiate -I .envrc | nix show-derivation -f derivation.nix --recursive -I .envrc | jq nix search --json 2>/dev/null |jq ,#+END_SRC @@ -457,12 +468,13 @@ postInstall: - nix flake update -- nix shell -f default.nix +- nix shell -f default.nix --print-build-logs - nix shell -c default.nix -- nix build - nix build `nix-instantiate` -- nix build -f default.nix +- 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 search --json 2>/dev/null |jq - nix flake show @@ -614,8 +626,8 @@ postInstall: - shell.nix --pure - shell.nix --pure -I .envrc -- nix-shell --pure -I nixpkgs=/nixpkgs-ra/nixpkgs -- nix-shell --pure -p "with import /nixpkgs-ra/nixpkgs {}; ldc" +- nix-shell --pure -I nixpkgs=<> +- nix-shell --pure -p "with import <> {}; ldc" - nix-shell --pure -p "with import /nixpkgs-ra/nixpkgs {}; [dub ldc]" - shell.nix direnv: export +IN_NIX_SHELL @@ -637,20 +649,20 @@ postInstall: - nix develop -- nix-build - nix-build -I nixpkgs= - nix-build -I .envrc -- nix build --print-build-logs -- nix build -I .envrc --print-build-logs - - nix build -f default.nix --print-build-logs - nix build -f derivation.nix --print-build-logs +- nix build -I .envrc --print-build-logs +- nix shell -f default.nix --print-build-logs +- nix develop --build -f derivation.nix -I .envrc --print-build-logs + - buildPhase - nix build -f default.nix && noti - nix build -f default.nix && ./result/bin/spine -v && noti -t "spine build" -m "see ./result/bin/spine" - +- nix develop --build -f derivation.nix -I .envrc --print-build-logs ./result/bin/spine @@ -673,12 +685,53 @@ mkShell { <> ]; shellHook = '' - if [[ -e ".envrc" ]]; then + if [[ -f ".envrc" ]]; then source .envrc fi eval "$(starship init bash)" ''; } + +# - shell.nix -I .envrc +# - shell.nix -I .envrc --pure +# - nix-shell -I nixpkgs=<> --pure +# - nix-shell -p "with import <> {}; ldc" --pure +# - nix-shell -p "with import <> {}; [dub ldc]" --pure + +# - nix-shell -p nixFlakes +# - nix-shell -p nixFlakes --pure +# - nix-shell -p nixFlakes --pure -p "with import <> {}; [dub ldc]" +# - nix-shell shell.nix direnv: export +IN_NIX_SHELL +# - nix-shell shell.nix + +# - nix-build -I nixpkgs=<> --pure +# - nix-build -I .envrc --pure +# - nix-build default.nix -I .envrc && results/bin/spine -v + +# - nix-instantiate | nix show-derivation | jq +# - nix-instantiate -I .envrc | nix show-derivation -f derivation.nix -I .envrc | jq +# - nix-instantiate | nix show-derivation --recursive | jq +# - nix-instantiate -I .envrc | nix show-derivation -f derivation.nix --recursive -I .envrc | jq +# - nix-instantiate | nix-build +# - nix-instantiate -I .envrc | nix-build -I .envrc + +# - nix shell -c default.nix + +# - nix shell -f default.nix --print-build-logs + +# - nix build -I .envrc --print-build-logs --pure +# - nix build -f default.nix --print-build-logs --pure +# - nix build -f derivation.nix --print-build-logs --pure + +# - nix build `nix-instantiate` +# - nix build `nix-instantiate -I .envrc` + +# - nix build -f default.nix && ./result/bin/spine -v && noti -t "spine build" -m "see ./result/bin/spine" + +# - nix run default.nix --print-build-logs +# - nix run -I .envrc default.nix --print-build-logs + +# - nix develop --build -f derivation.nix -I .envrc --print-build-logs #+END_SRC **** parts @@ -687,11 +740,13 @@ mkShell { #+NAME: shell_packages_nix_related #+BEGIN_SRC nix ### nix_related +direnv nixFlakes nix-prefetch-git validatePkgConfig jq git +#ps #+END_SRC ***** packages d build related @@ -788,7 +843,7 @@ pkgs.mkShell { buildPhase = "nix build -f default.nix"; shellHook = '' echo "built spine @ ./result/bin/spine" - if [[ -e ".envrc" ]]; then + if [[ -f ".envrc" ]]; then source .envrc fi nix-instantiate | nix show-derivation | jq @@ -802,19 +857,22 @@ pkgs.mkShell { e.g. default.nix -I nixpkgs=/nixpkgs-ra/nixpkgs - nix-build -I nixpkgs= - e.g. nix-build -I nixpkgs=/nixpkgs-ra/nixpkgs + e.g. nix-build -I nixpkgs=<> #+BEGIN_SRC sh -nix-build -I nixpkgs=/nixpkgs-ra/nixpkgs -nix-build -I .env/local +nix-build -I nixpkgs=<> +nix-build -I .envrc-local nix-build -I .envrc default.nix -I .envrc default.nix -nix build -nix build -f default.nix -nix build -f project.nix -nix build -f spine.nix +nix build -f default.nix --print-build-logs +nix build -f derivation.nix --print-build-logs +nix shell -f default.nix --print-build-logs +nix develop --build -f derivation.nix -I .envrc --print-build-logs + +# nix build -f project.nix +# nix build -f spine.nix #+END_SRC #+HEADER: :tangle ../default.nix @@ -1071,17 +1129,17 @@ if ! has nix_direnv_version || ! nix_direnv_version 1.4.0; then # https://github.com/nix-community/nix-direnv source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/1.4.0/direnvrc" "sha256-4XfVDjv75eHMWN4G725VW7BoOV4Vl3vAabK4YXIfPyE=" fi -if [ -e .env/local ]; then - source_env_if_exists .env/local || source .env/local +if [ -f .envrc-local ]; then + source_env_if_exists .envrc-local || source .envrc-local fi #+END_SRC -**** .env/local +**** .envrc-local -#+HEADER: :tangle "../sundry/spine_search_cgi/.env/local_" -#+BEGIN_SRC sh -export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos -#export NIX_PATH=nixpkgs=/nixpkgs-ra/nixpkgs +#+HEADER: :tangle "../sundry/spine_search_cgi/.envrc-local_" +#+BEGIN_SRC nix +export NIX_PATH=<> +#export NIX_PATH=nixpkgs=<> # reload when these files change # watch_file flake.nix # watch_file flake.lock @@ -1098,12 +1156,12 @@ export SpinePOD=$SpineDOC/markup/pod export SpineOUT=<> export SpineDBpath=<> export SpineCgiBIN=<> -if [ -e .env/echo-nixNote ]; then # source an additional user-specific .envrc in ./.env/local +if [ -e .env/echo-nixNote ]; then # source an additional user-specific .envrc in ./.envrc-local source .env/echo-nixNote fi #+END_SRC -**** .env/local +**** .envrc-local #+HEADER: :tangle "../sundry/spine_search_cgi/.env/echo-nixNote" #+BEGIN_SRC sh @@ -1123,8 +1181,9 @@ echo ' nix-shell --pure nix-build -nix build -f default.nix -nix shell -f default.nix +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` @@ -1272,7 +1331,7 @@ mkShell { <> ]; shellHook = '' - if [[ -e ".envrc" ]]; then + if [[ -f ".envrc" ]]; then source .envrc fi eval "$(starship init bash)" @@ -1451,26 +1510,31 @@ spine_search - #+NAME: nixpkgs_path_default +#+HEADER: :noweb yes #+BEGIN_SRC nix #+END_SRC #+NAME: nix_path_directory +#+HEADER: :noweb yes #+BEGIN_SRC nix nixpkgs=<> #+END_SRC #+NAME: project_path_local_project +#+HEADER: :noweb yes #+BEGIN_SRC nix /grotto-ra/repo/git.repo/projects/project-spine/doc-reform #+END_SRC #+NAME: project_path_local_src +#+HEADER: :noweb yes #+BEGIN_SRC nix -/grotto-ra/repo/git.repo/projects/project-spine/doc-reform/src +<>/src #+END_SRC #+NAME: project_path_local_bin +#+HEADER: :noweb yes #+BEGIN_SRC nix <>/result/bin #+END_SRC @@ -1491,11 +1555,13 @@ nixpkgs=<> #+END_SRC #+NAME: project_path_local_out_ +#+HEADER: :noweb yes #+BEGIN_SRC nix /tmp/spine/$SpineVER/www #+END_SRC #+NAME: project_path_local_out_static +#+HEADER: :noweb yes #+BEGIN_SRC nix /srv/www/spine #+END_SRC @@ -1505,7 +1571,6 @@ nixpkgs=<> /var/www #+END_SRC - #+NAME: project_path_sqlite #+BEGIN_SRC nix /var/www/sqlite @@ -1567,7 +1632,7 @@ pkgs.mkShell { # liberation_ttf #]; shellHook = '' - if [[ -e ".envrc" ]]; then + if [[ -f ".envrc" ]]; then source .envrc fi #for texfile in *.tex; do xelatex -interaction=nonstopmode $texfile; done diff --git a/shell.nix b/shell.nix index 4ed35b0..e27e127 100755 --- a/shell.nix +++ b/shell.nix @@ -4,11 +4,13 @@ with pkgs; mkShell { buildInputs = [ ### nix_related + direnv nixFlakes nix-prefetch-git validatePkgConfig jq git + #ps ### d_build_related ## package manager dub @@ -45,9 +47,50 @@ mkShell { starship ]; shellHook = '' - if [[ -e ".envrc" ]]; then + if [[ -f ".envrc" ]]; then source .envrc fi eval "$(starship init bash)" ''; } + +# - shell.nix -I .envrc +# - shell.nix -I .envrc --pure +# - nix-shell -I nixpkgs=/nixpkgs-ra/nixpkgs --pure +# - nix-shell -p "with import /nixpkgs-ra/nixpkgs {}; ldc" --pure +# - nix-shell -p "with import /nixpkgs-ra/nixpkgs {}; [dub ldc]" --pure + +# - nix-shell -p nixFlakes +# - nix-shell -p nixFlakes --pure +# - nix-shell -p nixFlakes --pure -p "with import /nixpkgs-ra/nixpkgs {}; [dub ldc]" +# - nix-shell shell.nix direnv: export +IN_NIX_SHELL +# - nix-shell shell.nix + +# - nix-build -I nixpkgs=/nixpkgs-ra/nixpkgs --pure +# - nix-build -I .envrc --pure +# - nix-build default.nix -I .envrc && results/bin/spine -v + +# - nix-instantiate | nix show-derivation | jq +# - nix-instantiate -I .envrc | nix show-derivation -f derivation.nix -I .envrc | jq +# - nix-instantiate | nix show-derivation --recursive | jq +# - nix-instantiate -I .envrc | nix show-derivation -f derivation.nix --recursive -I .envrc | jq +# - nix-instantiate | nix-build +# - nix-instantiate -I .envrc | nix-build -I .envrc + +# - nix shell -c default.nix + +# - nix shell -f default.nix --print-build-logs + +# - nix build -I .envrc --print-build-logs --pure +# - nix build -f default.nix --print-build-logs --pure +# - nix build -f derivation.nix --print-build-logs --pure + +# - nix build `nix-instantiate` +# - nix build `nix-instantiate -I .envrc` + +# - nix build -f default.nix && ./result/bin/spine -v && noti -t "spine build" -m "see ./result/bin/spine" + +# - nix run default.nix --print-build-logs +# - nix run -I .envrc default.nix --print-build-logs + +# - nix develop --build -f derivation.nix -I .envrc --print-build-logs diff --git a/sundry/spine_search_cgi/.envrc b/sundry/spine_search_cgi/.envrc index c0adda9..6d8376c 100644 --- a/sundry/spine_search_cgi/.envrc +++ b/sundry/spine_search_cgi/.envrc @@ -3,6 +3,6 @@ if ! has nix_direnv_version || ! nix_direnv_version 1.4.0; then # https://github.com/nix-community/nix-direnv source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/1.4.0/direnvrc" "sha256-4XfVDjv75eHMWN4G725VW7BoOV4Vl3vAabK4YXIfPyE=" fi -if [ -e .env/local ]; then - source_env_if_exists .env/local || source .env/local +if [ -f .envrc-local ]; then + source_env_if_exists .envrc-local || source .envrc-local fi diff --git a/sundry/spine_search_cgi/.envrc-local_ b/sundry/spine_search_cgi/.envrc-local_ index 440b597..92f4fea 100644 --- a/sundry/spine_search_cgi/.envrc-local_ +++ b/sundry/spine_search_cgi/.envrc-local_ @@ -7,7 +7,8 @@ export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos # eval "$(nix print-dev-env)" # echo $NIX_BUILD_TOP export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g') -export SpineSRC=/grotto-ra/repo/git.repo/projects/project-spine/doc-reform +export SpinePROJ=/grotto-ra/repo/git.repo/projects/project-spine/doc-reform +export SpineSRC=/grotto-ra/repo/git.repo/projects/project-spine/doc-reform/src export SpineBIN=/grotto-ra/repo/git.repo/projects/project-spine/doc-reform/result/bin export SpineDOC=/grotto-ra/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples export SpinePOD=$SpineDOC/markup/pod @@ -15,116 +16,6 @@ export SpinePOD=$SpineDOC/markup/pod export SpineOUT=/srv/www/spine export SpineDBpath=/var/www/sqlite export SpineCgiBIN=/var/www/cgi/cgi-bin - -echo '-*- mode: org -*- - -* nixpkgs path? - - # eval "$(nix print-dev-env)" -' > nixNote_.org - -echo " == `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 -nix shell -f default.nix -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" +if [ -e .env/echo-nixNote ]; then # source an additional user-specific .envrc in ./.envrc-local + source .env/echo-nixNote +fi diff --git a/sundry/spine_search_cgi/shell.nix b/sundry/spine_search_cgi/shell.nix index b45dcdd..64a4e02 100755 --- a/sundry/spine_search_cgi/shell.nix +++ b/sundry/spine_search_cgi/shell.nix @@ -4,11 +4,13 @@ with pkgs; mkShell { buildInputs = [ ### nix_related + direnv nixFlakes nix-prefetch-git validatePkgConfig jq git + #ps ### d_build_related ## package manager dub @@ -32,7 +34,7 @@ mkShell { starship ]; shellHook = '' - if [[ -e ".envrc" ]]; then + if [[ -f ".envrc" ]]; then source .envrc fi eval "$(starship init bash)" -- cgit v1.2.3