From 85a2a2922673bfe44461e26b68cb1da0de5bb8c7 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 20 Sep 2021 20:02:10 -0400 Subject: nix related config, direnv else minor --- sundry/spine_search_cgi/.envrc | 4 ++ sundry/spine_search_cgi/.envrc-local_ | 50 ++++++++++++------------- sundry/spine_search_cgi/dub.json | 5 +-- sundry/spine_search_cgi/shell.nix | 16 ++++++-- sundry/spine_search_cgi/views/configuration.txt | 2 +- 5 files changed, 43 insertions(+), 34 deletions(-) (limited to 'sundry/spine_search_cgi') diff --git a/sundry/spine_search_cgi/.envrc b/sundry/spine_search_cgi/.envrc index 6bb4547..03af170 100644 --- a/sundry/spine_search_cgi/.envrc +++ b/sundry/spine_search_cgi/.envrc @@ -1,4 +1,8 @@ NIX_ENFORCE_PURITY=0 +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 .envrc-local ]; then # source an additional user-specific .envrc in ./.envrc-local source .envrc-local fi diff --git a/sundry/spine_search_cgi/.envrc-local_ b/sundry/spine_search_cgi/.envrc-local_ index d14a371..e79a418 100644 --- a/sundry/spine_search_cgi/.envrc-local_ +++ b/sundry/spine_search_cgi/.envrc-local_ @@ -1,10 +1,10 @@ export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos #export NIX_PATH=nixpkgs=/nixpkgs-ra/nixpkgs # reload when these files change -watch_file flake.nix +# watch_file flake.nix # watch_file flake.lock ## load the flake devShell -eval "$(nix print-dev-env)" +# 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 @@ -12,17 +12,17 @@ export SpineBIN=/grotto-ra/repo/git.repo/projects/project-spine/doc-reform/resul export SpineDOC=/grotto-ra/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples export SpinePOD=$SpineDOC/markup/pod #export SpineOUTversioned=/srv/www/spine/$SpineVER -export SpineOUTstatic=/srv/www/spine/static +export SpineOUT=/srv/www/spine export SpineCgiBIN=/var/www/cgi/cgi-bin echo '-*- mode: org -*- * nixpkgs path? - eval "$(nix print-dev-env)" -' > nix_note_.org + # eval "$(nix print-dev-env)" +' > nixNote_.org -echo " == `nix-instantiate --find-file nixpkgs`" >> nix_note_.org +echo " == `nix-instantiate --find-file nixpkgs`" >> nixNote_.org echo ' * nix build and show derivation @@ -46,12 +46,12 @@ nix search --json 2>/dev/null |jq * version and build info -#+BEGIN_SRC sh' >> nix_note_.org +#+BEGIN_SRC sh' >> nixNote_.org -echo 'spine version (git) == $SpineVER' >> nix_note_.org -echo "spine version (git) == $SpineVER" >> nix_note_.org -echo 'nix-instantiate == `nix-instantiate`' >> nix_note_.org -echo "nix-instantiate == `nix-instantiate`" >> nix_note_.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 @@ -63,10 +63,10 @@ SpineBIN=$SpineBIN SpineDOC=$SpineDOC SpinePOD=$SpinePOD #SpineOUTversioned=$SpineOUTversioned -SpineOUTstatic=$SpineOUTstatic +SpineOUT=$SpineOUT SpineCgiBIN=$SpineCgiBIN #+END_SRC -" >> nix_note_.org +" >> nixNote_.org echo '* cgi form spine_search nix build and copy to spine-search @@ -75,7 +75,7 @@ nix-build && sudo cp -vi result/share/cgi-bin/spine_search $SpineCgiBIN/. #+END_SRC * spine run instruction examples -** cgi operations (output to $SpineOUTstatic) +** cgi operations (output to $SpineOUT) *** configuration #+BEGIN_SRC sh @@ -85,43 +85,43 @@ $SpineBIN/spine -v --show-config --config=$SpinePOD/.dr *** 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=$SpineOUTstatic $SpinePOD/* +$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" --output=$SpineOUTstatic $SpinePOD/* +SpineBIN/spine -v --sqlite-update --sqlite-db-filename="spine.search.db" --output=$SpineOUT $SpinePOD/* #+END_SRC *** generate curate #+BEGIN_SRC sh -$SpineBIN/spine -v --curate --output=$SpineOUTstatic $SpinePOD/* -$SpineBIN/spine -v --html --html-link-curate --curate --output=$SpineOUTstatic $SpinePOD/* +$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" --output="$SpineOUTstatic" +$SpineBIN/spine -v --sqlite-db-recreate --sqlite-db-filename="spine.search.db" --output="$SpineOUT" #+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 --output=$SpineOUTstatic $SpinePOD/* +$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 --output=$SpineOUT $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=$SpineOUTstatic $SpinePOD/* +#$SpineBIN/spine -v --cgi-search-form-codegen --output=$SpineOUT $SpinePOD/* #+END_SRC -' >> nix_note_.org +' >> nixNote_.org -cat nix_note_.org +#cat nixNote_.org -echo "emacs nix_note_.org" -echo "cat nix_note_.org" +#echo "emacs nixNote_.org" +#echo "cat nixNote_.org" diff --git a/sundry/spine_search_cgi/dub.json b/sundry/spine_search_cgi/dub.json index 1668969..12e77e5 100644 --- a/sundry/spine_search_cgi/dub.json +++ b/sundry/spine_search_cgi/dub.json @@ -81,8 +81,5 @@ "name": "dmd", "targetName": "spine-search-dmd.cgi" } - ], - "subConfigurations": { - "d2sqlite3": "with-lib" - } + ] } diff --git a/sundry/spine_search_cgi/shell.nix b/sundry/spine_search_cgi/shell.nix index 7f37eee..5926e62 100755 --- a/sundry/spine_search_cgi/shell.nix +++ b/sundry/spine_search_cgi/shell.nix @@ -3,20 +3,28 @@ pkgs.mkShell { buildInputs = with pkgs; [( with pkgs; [ + # nix_related nixFlakes - rund - dub - ldc - sqlite nix-prefetch-git validatePkgConfig jq git + # d_build_related + rund + dub + ldc + #meson + # search_sqlite_related + # search related + sqlite + # candy + starship ] )]; shellHook = '' if [[ -e ".envrc" ]]; then source .envrc fi + eval "$(starship init bash)" ''; } diff --git a/sundry/spine_search_cgi/views/configuration.txt b/sundry/spine_search_cgi/views/configuration.txt index 1486315..e810d68 100644 --- a/sundry/spine_search_cgi/views/configuration.txt +++ b/sundry/spine_search_cgi/views/configuration.txt @@ -3,7 +3,7 @@ struct Cfg { string http_host = "localhost"; string www_url_doc_root = "http://localhost"; string www_doc_root = "/srv/www/spine/static"; - string cgi_bin_subpath = "/cgi-bin"; + string cgi_bin_subpath = ""; string cgi_filename = "spine_search"; // "spine-search" string cgi_search_form_title = "≅ SiSU Spine search"; string db_sqlite_path = "/var/www/sqlite"; -- cgit v1.2.3