From fd3cdddf8ca1b2c46ef5b9da337efec7b1646635 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph.amissah@gmail.com>
Date: Thu, 22 Apr 2021 15:25:29 -0400
Subject: org .envrc-local_ (sample for nix-shell)

---
 org/spine_build_scaffold.org | 119 +++++++++++++++++++++++++++++++++++++++----
 1 file changed, 108 insertions(+), 11 deletions(-)

(limited to 'org')

diff --git a/org/spine_build_scaffold.org b/org/spine_build_scaffold.org
index a6bbd72..9431d96 100644
--- a/org/spine_build_scaffold.org
+++ b/org/spine_build_scaffold.org
@@ -29,6 +29,7 @@
 ** subprojects
 
 - d2sqlite3
+  https://code.dlang.org/packages/d2sqlite3
 
 #+NAME: version_d2sqlite3
 #+BEGIN_SRC sh
@@ -36,6 +37,7 @@
 #+END_SRC
 
 - imageformats
+  https://code.dlang.org/packages/imageformats
 
 #+NAME: version_imageformats
 #+BEGIN_SRC sh
@@ -43,13 +45,15 @@
 #+END_SRC
 
 - dyaml
+  https://code.dlang.org/packages/dyaml
 
 #+NAME: version_dyaml
 #+BEGIN_SRC sh
-0.8.0
+0.8.3
 #+END_SRC
 
 - tinyendian
+  https://code.dlang.org/packages/tinyendian
 
 #+NAME: version_tinyendian
 #+BEGIN_SRC sh
@@ -411,7 +415,7 @@ get_depends:
 	done; \
 	cd $${hwd}
 set_depends: get_depends
-	dub describe | sed 's_$(shell echo `pwd | sed 's_/_\\/_g'`)_._g'  > dub_describe.json
+	dub describe | sed 's~$(shell echo `pwd | sed 's_/_\\/_g'`)~.~g'  > dub_describe.json
 rm_flakelock:
 	git reset HEAD flake.lock && \
 	touch flake.lock \
@@ -2172,19 +2176,101 @@ fi
 - bespoke modify appropriately and generate if needed
 
 #+BEGIN_SRC nix :tangle ../.envrc-local_
-export NIX_PATH=nixpkgs=<<nixpkgs_path>>
+export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos
+#export NIX_PATH=nixpkgs=<<nixpkgs_path>>
 ## reload when these files change
 watch_file flake.nix
 # watch_file flake.lock
 ## load the flake devShell
 eval "$(nix print-dev-env)"
 # echo $NIX_BUILD_TOP
-echo "<nixpkgs> `nix-instantiate --find-file nixpkgs`"
-export PROJ=<<project_path_local>>
-echo "PROJ=<<project_path_local>>"
-echo '$PROJ/doc-reform/result/bin/spine --very-verbose --pod --source --output="/tmp/www" $PROJ/doc-reform-markup/spine-markup-samples/markup/pod/*'
-echo '$PROJ/doc-reform/result/bin/spine --very-verbose --html --epub --output="/tmp/www" $PROJ/doc-reform-markup/spine-markup-samples/markup/pod/*'
-echo '$PROJ/doc-reform/result/bin/spine --very-verbose --sqlite-discrete --output="/tmp/www" $PROJ/doc-reform-markup/spine-markup-samples/markup/pod/*'
+export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g')
+export SpineSRC=<<project_path_local_src>>
+export SpineDOC=<<project_path_local_doc>>
+export SpineOUT=<<project_path_local_out>>
+
+echo '-*- mode: org -*-
+
+,* nixpkgs path?
+
+  eval "$(nix print-dev-env)"
+' > SHELL_NIX_NOTE_
+
+echo "  <nixpkgs> == `nix-instantiate --find-file nixpkgs`" >> SHELL_NIX_NOTE_
+
+echo '
+,* nix build and show derivation
+
+  nix-shell --pure
+
+  nix-build
+  nix build -f default.nix
+  nix shell -f default.nix
+  nix-instantiate | nix-build
+  nix build `nix-instantiate`
+
+  nix-instantiate | nix show-derivation | jq
+  nix-instantiate | nix show-derivation --recursive | jq
+
+,* version and build info
+' >> SHELL_NIX_NOTE_
+
+echo "  spine version (git) == $SpineVER" >> SHELL_NIX_NOTE_
+echo "  nix-instantiate == `nix-instantiate`" >> SHELL_NIX_NOTE_
+
+echo '
+,* initialised shell variables
+
+  SpineSRC=<<project_path_local_src>>
+  SpineDOC=<<project_path_local_doc>>
+  SpineOUT=<<project_path_local_out>>
+
+,* spine run instruction examples
+,** parallelized tasks
+
+  - doc source
+    $SpineSRC/result/bin/spine --very-verbose --pod --source --output="$SpineOUT" $SpineDOC/markup/pod/*
+
+  - html & epub output
+    $SpineSRC/result/bin/spine --very-verbose --html --epub --output="$SpineOUT" $SpineDOC/markup/pod/*
+
+  - sqlite db for each document - populate each db
+    $SpineSRC/result/bin/spine --very-verbose --sqlite-discrete --output="$SpineOUT" $SpineDOC/markup/pod/*
+
+  - doc source; html, epub; sqlite outputs
+    $SpineSRC/result/bin/spine --verbose --pod --html --epub --sqlite-discrete --output="$SpineOUT" $SpineDOC/markup/pod/*
+
+  - harvest (authors topics)
+    $SpineSRC/result/bin/spine --very-verbose --harvest --output="$SpineOUT" $SpineDOC/markup/pod/*
+    $SpineSRC/result/bin/spine --very-verbose --html --html-link-harvest --harvest --output="$SpineOUT" $SpineDOC/markup/pod/*
+
+  - composite command: source pod, html, epub, harvest, sqlite
+    $SpineSRC/result/bin/spine --verbose --dark --pod --epub --html --html-link-harvest --harvest --sqlite-discrete --output="$SpineOUT" $SpineDOC/markup/pod/*
+
+,** sequential tasks
+
+  - sqlite db (shared)  - create db
+    $SpineSRC/result/bin/spine --very-verbose --sqlite-db-create --output="$SpineOUT"
+  - sqlite db (shared) - populate db
+    $SpineSRC/result/bin/spine --very-verbose --sqlite-update --output="$SpineOUT" $SpineDOC/spine-markup-samples/markup/pod/*
+  - sqlite db (shared) - drop db
+    $SpineSRC/result/bin/spine --very-verbose --sqlite-db-drop --output="$SpineOUT"
+
+  - sqlite db (shared) - create & populate db (single step)
+    $SpineSRC/result/bin/spine --very-verbose --sqlite-db-create --sqlite-update --output="$SpineOUT" $SpineDOC/markup/pod/*
+
+  - composite command: source pod, html, epub, harvest, sqlite
+    $SpineSRC/result/bin/spine --verbose --no-parallel --dark --pod --epub --html --html-link-harvest --harvest --sqlite-discrete --output="$SpineOUT" $SpineDOC/markup/pod/*
+
+,** config [./pod/].dr/config_local_site
+
+  cat $SpineDOC/markup/pod/.dr/config_local_site
+  $SpineSRC/result/bin/spine --show-config $SpineDOC/markup/pod
+  $SpineSRC/result/bin/spine --show-config --output="$SpineOUT" $SpineDOC/markup/pod
+
+' >> SHELL_NIX_NOTE_
+cat SHELL_NIX_NOTE_
+
 #+END_SRC
 
 **** nixpkgs_path SETUP
@@ -2215,9 +2301,19 @@ echo '$PROJ/doc-reform/result/bin/spine --very-verbose --sqlite-discrete --outpu
 
 - local path SET WARN
 
-#+NAME: project_path_local
+#+NAME: project_path_local_src
+#+BEGIN_SRC nix
+/grotto-ra/repo/git.repo/projects/project-spine/doc-reform
+#+END_SRC
+
+#+NAME: project_path_local_doc
+#+BEGIN_SRC nix
+/grotto-ra/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples
+#+END_SRC
+
+#+NAME: project_path_local_out
 #+BEGIN_SRC nix
-/grotto-ra/repo/git.repo/projects/project-spine
+/tmp/spine/$SpineVER/www
 #+END_SRC
 
 ** flake :flake:
@@ -2872,6 +2968,7 @@ sqlite
 nix-prefetch-git
 validatePkgConfig
 jq
+git
 #+END_SRC
 
 * .gitignore :gitignore:
-- 
cgit v1.2.3