From 970eea0a508d3a0a1f8c9e01c3667ceedaa5fb0f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 26 Jan 2023 21:16:47 -0500 Subject: nix flake & build, devShells etc. --- .env/echo-nixNote | 239 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ .env/nix-commands | 20 +++++ 2 files changed, 259 insertions(+) create mode 100644 .env/echo-nixNote create mode 100644 .env/nix-commands (limited to '.env') diff --git a/.env/echo-nixNote b/.env/echo-nixNote new file mode 100644 index 0000000..ad8717f --- /dev/null +++ b/.env/echo-nixNote @@ -0,0 +1,239 @@ +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 --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 + +* 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 +SpineDOC=$SpineDOC +SpinePOD=$SpinePOD +SpineOUTversioned=$SpineOUTversioned +SpineOUT=$SpineOUT +#+END_SRC +" >> nixNote_.org + +echo '* spine run instruction examples +** parallelized tasks +*** doc source + +#+BEGIN_SRC sh +$SpineBIN/spine --very-verbose --pod --source --output="$SpineOUTversioned" $SpinePOD/* +#+END_SRC + +*** html & epub output + +#+BEGIN_SRC sh +$SpineBIN/spine --very-verbose --html --epub --output="$SpineOUTversioned" $SpinePOD/* +#+END_SRC + +*** sqlite db for each document - populate each db + +#+BEGIN_SRC sh +$SpineBIN/spine --very-verbose --sqlite-discrete --output="$SpineOUTversioned" $SpinePOD/* +#+END_SRC + +*** doc source; html, epub; sqlite outputs + +#+BEGIN_SRC sh +$SpineBIN/spine --verbose --pod --html --epub --sqlite-discrete --output="$SpineOUTversioned" $SpinePOD/* +#+END_SRC + +*** curate (authors topics) + +#+BEGIN_SRC sh +$SpineBIN/spine --very-verbose --curate --output="$SpineOUTversioned" $SpinePOD/* +#+END_SRC + +*** html, curate + +#+BEGIN_SRC sh +$SpineBIN/spine --verbose --dark --html --html-link-curate --curate --output="$SpineOUTversioned" $SpinePOD/* +$SpineBIN/spine --very-verbose --html --html-link-curate --curate --output="$SpineOUTversioned" $SpinePOD/* +#+END_SRC + +*** composite command: source pod, html, epub, curate, sqlite + +#+BEGIN_SRC sh +$SpineBIN/spine --verbose --dark --pod --epub --html --html-link-curate --curate --sqlite-discrete --output="$SpineOUTversioned" $SpinePOD/* +#+END_SRC + +** sequential tasks +*** sqlite db (shared) - create db + +#+BEGIN_SRC sh +$SpineBIN/spine --very-verbose --sqlite-db-create --output="$SpineOUTversioned" +#+END_SRC + +*** sqlite db (shared) - populate db + +#+BEGIN_SRC sh +$SpineBIN/spine --very-verbose --sqlite-update --output="$SpineOUTversioned" $SpineDOC/spine-markup-samples/markup/pod/* +#+END_SRC + +*** sqlite db (shared) - drop db + +#+BEGIN_SRC sh +$SpineBIN/spine --very-verbose --sqlite-db-drop --output="$SpineOUTversioned" +#+END_SRC + +*** sqlite db (shared) - create & populate db (single step) + +#+BEGIN_SRC sh +$SpineBIN/spine --very-verbose --sqlite-db-create --sqlite-update --output="$SpineOUTversioned" $SpinePOD/* +#+END_SRC + +*** composite command: source pod, html, epub, curate, sqlite + +#+BEGIN_SRC sh +$SpineBIN/spine --verbose --no-parallel --dark --pod --epub --html --html-link-curate --curate --sqlite-discrete --output="$SpineOUTversioned" $SpinePOD/* +#+END_SRC + +** config [./pod/].dr/config_local_site + +#+BEGIN_SRC sh +cat $SpinePOD/.dr/config_local_site +$SpineBIN/spine --show-config $SpinePOD +$SpineBIN/spine --show-config --output="$SpineOUTversioned" $SpinePOD +#+END_SRC + +** cgi operations (output to $SpineOUT /var/www) + +#+BEGIN_SRC sh +$SpineBIN/spine --very-verbose --sqlite-db-create --output="$SpineOUT" $SpinePOD/* + +$SpineBIN/spine -v --cgi-search-form-codegen --output=$SpineOUT $SpinePOD/* + +$SpineBIN/spine -v --show-config --config=$SpinePOD/.dr + +$SpineBIN/spine --html $SpinePOD/* + + +$SpineBIN/spine -v --cgi-search-form-codegen --config=$SpinePOD/.dr/config_local_site +#+END_SRC + +*** generate html linked to search form + +#+BEGIN_SRC sh +$SpineBIN/spine -v --html --html-link-search --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-create --sqlite-db-filename="spine.search.db" --sqlite-db-path="$SpineDBpath" +$SpineBIN/spine -v --sqlite-db-recreate --sqlite-db-filename="spine.search.db" --sqlite-db-path="$SpineDBpath" +#+END_SRC + +*** populate sqlite db + +#+BEGIN_SRC sh +$SpineBIN/spine -v --sqlite-update --sqlite-db-filename="spine.search.db" --output=$SpineOUT $SpinePOD/* +#+END_SRC + +*** generate html (linked to search form), sql output, curate COMPOSITE + +#+BEGIN_SRC sh +$SpineBIN/spine -v --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/* +$SpineBIN/spine --epub --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename="spine.search.db" --cgi-sqlite-search-filename="spine_search" --cgi-url-action="https://sisudoc.org/spine_search" --ouput="$SpineOUT" $SpinePOD/* +#+END_SRC + +*** generate html (linked to search form), sql output, curate COMPOSITE with resource configuration + +if names and paths are configured in resource configuration file, e.g. $SpinePOD/.rc/config_local_site + +#+BEGIN_SRC sh +$SpineBIN/spine -v --html --html-link-search --html-link-curate --curate --sqlite-update $SpinePOD/* +#+END_SRC + +#+BEGIN_SRC yaml +# sample resource configuration file ( $SpinePOD/.rc/config_local_site ) +output: + path: "/srv/www/spine" +default: + language: "en" + papersize: "a4" + text_wrap: "80" + digest: "sha256" +webserv: + http: "http" + domain: "localhost" + data_http: "http" + data_domain: "localhost" + data_root_url: "https://sisudoc.org" + data_root_path: "/srv/www/spine" + images_root_part: "image" + cgi_search_form_title: "≅ SiSU Spine search" + cgi_http: "https" + cgi_domain: "sisudoc.org" + cgi_bin_url: "http://sisudoc.org/cgi-bin" + cgi_bin_part: "cgi-bin" + cgi_bin_path: "/var/www/cgi/cgi-bin" + cgi_search_script: "spine_search" + cgi_action: "https://sisudoc.org/spine_search" + db_sqlite_filename: "spine.search.db" + db_sqlite_path: "/var/www/sqlite" +#+END_SRC + +*** make search form + +#+BEGIN_SRC sh +$SpineBIN/spine -v --cgi-search-form-codegen --config=$SpinePOD/.dr/config_local_site +#+END_SRC + +*** latex + +#+BEGIN_SRC sh +$SpineBIN/spine --latex --serial --output="$SpineOUT" $SpinePOD/* +ls $SpineOutstatic/latex/*.tex +#+END_SRC +' >> nixNote_.org + +#cat nixNote_.org + +#echo "emacs nixNote_.org" +#echo "cat nixNote_.org" diff --git a/.env/nix-commands b/.env/nix-commands new file mode 100644 index 0000000..7cfa723 --- /dev/null +++ b/.env/nix-commands @@ -0,0 +1,20 @@ +- nix flake update && nix flake check --show-trace && nix flake show && nix develop .#devShell + +- nix build .#default --print-build-logs +- nix build .#spine-dmd --print-build-logs +- nix build .#spine-ldc --print-build-logs +- nix build .#spine-gdc --print-build-logs + +- nix develop + - nix develop .#devShell --print-build-logs + - nix develop .#devShell-html --print-build-logs + - nix develop .#devShell-epub --print-build-logs + - nix develop .#devShell-latex-pdf --print-build-logs + - nix develop .#devShell-sqlite --print-build-logs + - nix develop .#devShell-i18n --print-build-logs + +nix run .#default --print-build-logs + +nix develop --build .#default --print-build-logs + +nix-shell '' -A nix --pure -- cgit v1.2.3