diff options
-rw-r--r-- | .envrc | 21 | ||||
-rw-r--r-- | .envrc-local_ | 14 | ||||
-rw-r--r-- | .envrc-nix | 17 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | flake.lock | 6 | ||||
-rw-r--r-- | flake.nix | 36 | ||||
-rw-r--r-- | makefile | 128 | ||||
-rw-r--r-- | org/config_env.org | 110 | ||||
-rw-r--r-- | org/config_git.org | 1 | ||||
-rw-r--r-- | org/config_make.org | 128 | ||||
-rw-r--r-- | org/config_nix.org | 110 | ||||
-rwxr-xr-x | shell.nix | 3 |
12 files changed, 318 insertions, 257 deletions
@@ -1,17 +1,6 @@ -NIX_ENFORCE_PURITY=1 -# - https://github.com/nix-community/nix-direnv -NixDirEnvVersion="2.2.1" -NixDirEnvSHA="sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs=" -#NixDirEnvSHAget="sha256-0000000000000000000000000000000000000000000=" -if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then - source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "${NixDirEnvSHA}" +if [ -f .envrc-local ]; then + source_env_if_exists .envrc-local || source .envrc-local +fi +if [ -f .envrc-nix ]; then + source_env_if_exists .envrc-nix || source .envrc-nix fi -watch_file flake.lock -watch_file flake.nix -watch_file makefile -#if [ -f .envrc-local ]; then -# source_env_if_exists .envrc-local || source .envrc-local -#fi -PATH_add result/bin -use flake . -#use flake .#default diff --git a/.envrc-local_ b/.envrc-local_ index c8c3f3d..a78a350 100644 --- a/.envrc-local_ +++ b/.envrc-local_ @@ -1,17 +1,15 @@ -#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" export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g') -#export SpineBIN=result/bin +export SpineBIN=result/bin 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 SpinePOD=${SpineDOC}/markup/pod export SpineOUT=/srv/www/spine -export SpineOUTversioned=/srv/www/spine/$SpineVER -export SpineDBpath=/var/www/sqlite -#export SpineDBpath=/srv/www/spine/sqlite -export SpineCGIbin=/var/www/cgi/cgi-bin +export SpineOUTversioned=/srv/www/spine/${SpineVER} export SpineSearchActionLocal='http://localhost/spine_search' export SpineSearchActionRemote='https://sisudoc.org/spine_search' export SpineCGIform='spine_search' export SpineSQLdb='spine.search.db' +export SpineCGIbin=/var/www/cgi/cgi-bin +export SpineDBpath=/var/www/sqlite +#export SpineDBpath=/srv/www/spine/sqlite diff --git a/.envrc-nix b/.envrc-nix new file mode 100644 index 0000000..579e33c --- /dev/null +++ b/.envrc-nix @@ -0,0 +1,17 @@ +NIX_ENFORCE_PURITY=1 +NixDirEnvVersion="2.3.0" +NixDirEnvSHA="sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8=" +if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "${NixDirEnvSHA}" +fi +watch_file flake.lock +watch_file flake.nix +watch_file makefile +watch_file .envrc-local +watch_file .envrc-nix +PATH_add result/bin +nix flake update +nix flake check +nix flake show +use flake . +#use flake .#default @@ -10,6 +10,7 @@ !*.nix !flake.lock !.envrc +!.envrc-nix !.env !.env/** !README.md @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1681956304, - "narHash": "sha256-unQAkIwasSPc51R+CHF+r+58WM4bU/lEnXPSpi6yAxg=", + "lastModified": 1682779028, + "narHash": "sha256-tFfSbwSLobpHRznAa35KEU3R+fsFWTlmpFhTUdXq8RE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5b7bbca14c3627153bd305bec9a71f98b56c140c", + "rev": "54abe781c482f51ff4ff534ebaba77db5bd97442", "type": "github" }, "original": { @@ -130,32 +130,6 @@ 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 SpineOUTversioned=$SpineOUT/$SpineVER - 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 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'`" - export spineNixHelp="cat ./.env/nix-commands" - export spineTest="nix shell .#default --print-build-logs --command spine --very-verbose --epub --html --html-link-search --html-link-curate --curate --output=\"\$SpineOUT\" $SpinePOD/*" - 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 spineEpub="spine --very-verbose --epub --output=\"\$SpineOUT\" $SpinePOD/*" - export spineLatex="spine --very-verbose --latex --output=\"\$SpineOUT\" $SpinePOD/*" - export spinePdf="spine --very-verbose --pdf --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; { @@ -168,7 +142,7 @@ packages = [ sqlite dub - dmd + #dmd ldc gnumake ]; @@ -207,7 +181,7 @@ inherit devEnv; packages = [ dub - dmd + #dmd ldc gnumake sqlite @@ -220,7 +194,7 @@ inherit devEnv; packages = [ dub - dmd + #dmd ldc gnumake sqlite @@ -237,7 +211,7 @@ inherit devEnv; packages = [ dub - dmd + #dmd ldc gnumake sqlite @@ -250,7 +224,7 @@ inherit devEnv; packages = [ dub - dmd + #dmd ldc gnumake sqlite @@ -1,3 +1,4 @@ +include .envrc-local PROG_VER_GIT :=$(shell echo `git describe --long --tags | sed -e "s/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g"`) PROG_VER_DECLARED :=$(shell echo `cat ./views/version.txt | grep --color=never "enum" | sed 's/.\+(\([0-9]\+\),[ \t]\+\([0-9]\+\),[ \t]\+\([0-9]\+\)[ \t]*).\+/\1.\2.\3/g'`) DUB=dub @@ -49,13 +50,15 @@ data/pod/two_bits.christopher_kelty \ data/pod/un_contracts_international_sale_of_goods_convention_1980 \ data/pod/viral_spiral.david_bollier Date := `date "+%Y%m%d"` -SpineBIN := "$${SpineBIN}" # './result/bin' -SpineOUT := "$${SpineOUT}" # '/srv/www/spine' -SpinePOD := "$${SpinePOD}" # '~/grotto/repo/git.repo/projects/doc-reform/data/markup/spine-samples/markup/pod' -SpineSearchActionLocal := 'http://localhost/spine_search' -SpineSearchActionRemote := 'https://sisudoc.org/spine_search' -SpineCGIform := 'spine_search' -SpineSQLdb := 'spine.search.db' +#SpineBIN := $(SpineBIN) # './result/bin' +#SpineOUT := $(SpineOUT) # '/srv/www/spine' +#SpinePOD := $(SpinePOD) # '~/grotto/repo/git.repo/projects/doc-reform/data/markup/spine-samples/markup/pod' +#SpineSearchActionLocal := $(SpineSearchActionLocal) # 'http://localhost/spine_search' +#SpineSearchActionRemote := $(SpineSearchActionRemote) # 'https://sisudoc.org/spine_search' +#SpineCGIform := $(SpineCGIform) # 'spine_search' +#SpineSQLdb := $(SpineSQLdb) # 'spine.search.db' +#SpineCGIbin := $(SpineCGIbin) # '/var/www/cgi/cgi-bin' +#SpineDBpath := "$(SpineDBpath)" # '/var/www/sqlite' hwd := `pwd` gwd := `pwd` + "/src/ext_depends" deps := "`ls -gx './src/ext_depends'`" @@ -80,6 +83,9 @@ nix-devshell: echo -ne '\n❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell"\n\n❯❯ nix build ".#default" --print-build-logs\n❯❯ nix build ".#spine-dmd" --print-build-logs\n❯❯ nix build ".#spine-ldc" --print-build-logs\n❯❯ nix build ".#spine-gdc" --print-build-logs\n\n'; \ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" +# nix build +build: nix-build-default + nix-build-default: nix build ".#default" --print-build-logs @@ -139,58 +145,80 @@ org-tangle: org-tangle *.org; \ cd - +# output local +out-local: + $(SpineBIN)/spine -v \ + --latex --latex-init \ + --epub --html \ + --html-link-search --html-link-pdf --html-link-curate --html-link-markup \ + --cgi-sqlite-search-filename=$(SpineCGIform) --cgi-url-action=$(SpineSearchActionLocal) \ + --sqlite-update --sqlite-db-filename=$(SpineSQLdb) \ + --curate \ + --output=$(SpineOUT) $(SpinePOD)/* + +# output remote +out-remote: + $(SpineBIN)/spine -v \ + --latex --latex-init \ + --epub --html \ + --html-link-search --html-link-pdf --html-link-curate --html-link-markup \ + --cgi-sqlite-search-filename=$(SpineCGIform) --cgi-url-action=$(SpineSearchActionRemote) \ + --sqlite-update --sqlite-db-filename="$(SpineSQLdb)" \ + --curate \ + --output=$(SpineOUT) $(SpinePOD)/* + # epub output out-epub: - $${SpineBIN}/spine -v \ - --epub --output=$${SpineOUT} $${SpinePOD}/* + $(SpineBIN)/spine -v \ + --epub --output=$(SpineOUT) $(SpinePOD)/* # html output with local search links out-html: - $${SpineBIN}/spine -v --generated-by \ + $(SpineBIN)/spine -v --generated-by \ --curate \ - --html --html-link-search --html-link-curate --cgi-url-action="$${SpineSearchActionLocal}" \ - --output=$${SpineOUT} $${SpinePOD}/* + --html --html-link-search --html-link-curate --cgi-url-action=$(SpineSearchActionLocal) \ + --output=$(SpineOUT) $(SpinePOD)/* # latex output out-latex: - $${SpineBIN}/spine -v \ + $(SpineBIN)/spine -v \ --latex \ - --output=$${SpineOUT} $${SpinePOD}/* + --output=$(SpineOUT) $(SpinePOD)/* # odf output out-odf: - $${SpineBIN}/spine -v \ + $(SpineBIN)/spine -v \ --odf \ - --output=$${SpineOUT} $${SpinePOD}/* + --output=$(SpineOUT) $(SpinePOD)/* # sqlite output out-sqlite: - $${SpineBIN}/spine -v \ - --sqlite-update --sqlite-db-filename="$${SpineSQLdb}" \ - --output=$${SpineOUT} $${SpinePOD}/* + $(SpineBIN)/spine -v \ + --sqlite-update --sqlite-db-filename=$(SpineSQLdb) \ + --output=$(SpineOUT) $(SpinePOD)/* # generate markup sample output with local search links output-samples-local: - $${SpineBIN}/spine -v \ + $(SpineBIN)/spine -v \ --latex --latex-init \ --epub \ --html --html-link-search --html-link-pdf --html-link-curate --html-link-markup \ - --cgi-sqlite-search-filename="$${SpineCGIform}" --cgi-url-action="$${SpineSearchActionLocal}" \ + --cgi-sqlite-search-filename=$(SpineCGIform) --cgi-url-action=$(SpineSearchActionLocal) \ --curate \ - --sqlite-update --sqlite-db-filename="$${SpineSQLdb}" \ - --output=$${SpineOUT} $${SpinePOD}/* + --sqlite-update --sqlite-db-filename="$(SpineSQLdb)" \ + --output=$(SpineOUT) $(SpinePOD)/* # generate markup sample output with remote search links output-samples-remote: - $${SpineBIN}/spine -v \ + $(SpineBIN)/spine -v \ --generated-by \ --latex --latex-init \ --epub \ --html --html-link-search --html-link-pdf --html-link-curate \ - --cgi-sqlite-search-filename="$${SpineCGIform}" --cgi-url-action="$${SpineSearchActionRemote}" \ + --cgi-sqlite-search-filename=$(SpineCGIform) --cgi-url-action=$(SpineSearchActionRemote) \ --curate \ - --sqlite-update --sqlite-db-filename="$${SpineSQLdb}" \ - --output=$${SpineOUT} $${SpinePOD}/* + --sqlite-update --sqlite-db-filename=$(SpineSQLdb) \ + --output=$(SpineOUT) $(SpinePOD)/* # generate markup sample output with local search links output-samples: output-samples-local @@ -321,36 +349,36 @@ org-e: # show markup pod source selections markup: - ls -1 --color=always $${SpinePOD} - ls -1 -d --color=always $${SpinePOD}/*/ + ls -1 --color=always $(SpinePOD) + ls -1 -d --color=always $(SpinePOD)/*/ # show markup pod source tree markup-pod-tree: - exa -alT --git -I'.git|.dub|*_' --color=always -L5 $${SpinePOD} | less -R + exa -alT --git -I'.git|.dub|*_' --color=always -L5 $(SpinePOD) | less -R # show markup pod source tree tree-src: - exa -alT --git -I'*_' --color=always -L5 $${SpineSRC}/doc_reform $${SpinePROJ}/views | less -R + exa -alT --git -I'*_' --color=always -L5 $(SpineSRC)/doc_reform $(SpinePROJ)/views | less -R ## show markup pod source tree #tree-src-omit: -# exa -alT --git -I'.git|.dub|*_' --color=always -L5 $${SpineSRC} $${SpinePROJ}/views | less -R +# exa -alT --git -I'.git|.dub|*_' --color=always -L5 $(SpineSRC) $(SpinePROJ)/views | less -R # show markup pod source tree tree-src-search-cgi: - exa -alT --git -I'*_' --color=always -L5 $${SpineSearchCGI}/src $${SpineSearchCGI}/views | less -R + exa -alT --git -I'*_' --color=always -L5 $(SpineSearchCGI)/src $(SpineSearchCGI)/views | less -R # show markup files markup-files: - cd $${SpinePOD}; \ + cd $(SpinePOD); \ find . -type f -iname "*sst"; \ cd -; \ - echo $${SpinePOD} -# find $${SpinePOD}/. -type f -iname "*sst" + echo $(SpinePOD) +# find $(SpinePOD)/. -type f -iname "*sst" # preview markup files vim markup-files-vi: - cd $${SpinePOD}; \ + cd $(SpinePOD); \ fd --max-depth 5 --type file -g "*.ss?" | sort \ | fzf \ --preview='bat --color "always" {}' \ @@ -360,7 +388,7 @@ markup-files-vi: # preview markup files emacs markup-files-e: - cd $${SpinePOD}; \ + cd $(SpinePOD); \ fd --max-depth 5 --type file -g "*.ss?" | sort \ | fzf \ --preview='bat --color "always" {}' \ @@ -380,21 +408,21 @@ markup-samples: markup-pod-samples markup-file-samples # markup samples pod manifests markup-pod-samples: - echo "$${SpinePOD}"; \ - find $${SpinePOD} -name pod.manifest | sort + echo $(SpinePOD); \ + find $(SpinePOD) -name pod.manifest | sort -#find $${SpinePOD} -name pod.manifest | sed -E 's:.+?(([/][^/]+){2})$:\1:' +#find $(SpinePOD) -name pod.manifest | sed -E 's:.+?(([/][^/]+){2})$:\1:' # markup samples sst files markup-file-samples: - echo "$${SpinePOD}"; \ - find $${SpinePOD} -name *.ss[tm] | sort + echo $(SpinePOD); \ + find $(SpinePOD) -name *.ss[tm] | sort # archive spine output (www) spineWWWarchive: cd /srv/www ; \ - rm spine_output.$${Date}.tar.bz2 ; \ - sudo tar --exclude='./spine/latex' --exclude='./spine/pod' --exclude='./spine/*_' -cjf spine_output.$${Date}.tar.bz2 ./spine ; \ + rm spine_output.$(Date).tar.bz2 ; \ + sudo tar --exclude='./spine/latex' --exclude='./spine/pod' --exclude='./spine/*_' -cjf spine_output.$(Date).tar.bz2 ./spine ; \ cd - # rsync archived spine output to Linode @@ -700,12 +728,12 @@ clean_tangle_build: clean tangle build tangle_build: tangle build -build: $(PRG_SRCDIR)/$(PRG_SRC) - $(DC) $(DC_FLAGS) \ - $(DC_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \ - $(PRG_SRCDIR)/$(PRG_SRC) +build-dc: $${PRG_SRCDIR}/$${PRG_SRC} + $${DC} $${DC_FLAGS} \ + $${DC_FLAG_BINOF}$${PRG_BINDIR}/$${PRG_BIN} \ + $${PRG_SRCDIR}/$${PRG_SRC} -rebuild: $(PRG_SRCDIR)/$(PRG_SRC) $(PRG_BINDIR)/$(PRG_BIN).o clean build +rebuild: $${PRG_SRCDIR}/$${PRG_SRC} $${PRG_BINDIR}/$${PRG_BIN}.o clean build makefile_new: make -k tangle_maker diff --git a/org/config_env.org b/org/config_env.org new file mode 100644 index 0000000..171316f --- /dev/null +++ b/org/config_env.org @@ -0,0 +1,110 @@ +-*- mode: org -*- +#+TITLE: spine (doc_reform) (project) environment +#+DESCRIPTION: env envrc used by make & nix +#+FILETAGS: :spine:build:tools: +#+AUTHOR: Ralph Amissah +#+EMAIL: [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]] +#+COPYRIGHT: Copyright (C) 2015 - 2023 Ralph Amissah +#+LANGUAGE: en +#+STARTUP: content hideblocks hidestars noindent entitiespretty +#+PROPERTY: header-args :exports code +#+PROPERTY: header-args+ :noweb yes +#+PROPERTY: header-args+ :results no +#+PROPERTY: header-args+ :cache no +#+PROPERTY: header-args+ :padline no +#+PROPERTY: header-args+ :mkdirp yes +#+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t + +- [[./doc-reform.org][doc-reform.org]] [[../org/][org/]] +- [[./config_nix.org][config_nix.org]] +- [[./config_make.org][config_make.org]] + +* envrc +** envrc :envrc: + +#+HEADER: :tangle ../.envrc +#+BEGIN_SRC sh +if [ -f .envrc-local ]; then + source_env_if_exists .envrc-local || source .envrc-local +fi +if [ -f .envrc-nix ]; then + source_env_if_exists .envrc-nix || source .envrc-nix +fi +#+END_SRC + +** .envrc-nix + +- https://github.com/nix-community/nix-direnv + - source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-0000000000000000000000000000000000000000000=" + +#+HEADER: :tangle ../.envrc-nix +#+BEGIN_SRC sh +NIX_ENFORCE_PURITY=1 +NixDirEnvVersion="<<direnv-version>>" +NixDirEnvSHA="<<direnv-sha>>" +if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "${NixDirEnvSHA}" +fi +watch_file flake.lock +watch_file flake.nix +watch_file makefile +watch_file .envrc-local +watch_file .envrc-nix +PATH_add result/bin +nix flake update +nix flake check +nix flake show +use flake . +#use flake .#default +#+END_SRC + +#+NAME: direnv-version +#+BEGIN_SRC sh +2.3.0 +#+END_SRC + +#+NAME: direnv-sha +#+BEGIN_SRC sh +sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8= +#+END_SRC + +#+NAME: direnv-sha_ +#+BEGIN_SRC sh +sha256-0000000000000000000000000000000000000000000= +#+END_SRC + +#+BEGIN_SRC sh +- https://github.com/nix-community/nix-direnv +NixDirEnvSHA="sha256-0000000000000000000000000000000000000000000=" +direnv fetchurl https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc +#+END_SRC + +** .envrc-local CHECK MODIFY + +- bespoke modify appropriately and generate if needed + +#+HEADER: :tangle ../.envrc-local_ +#+HEADER: :noweb yes +#+BEGIN_SRC sh +export DFLAGS="-O2 -inline -boundscheck=on -color=on" +export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g') +export SpineBIN=result/bin +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 SpinePOD=${SpineDOC}/markup/pod +export SpineOUT=/srv/www/spine +export SpineOUTversioned=/srv/www/spine/${SpineVER} +export SpineSearchActionLocal='http://localhost/spine_search' +export SpineSearchActionRemote='https://sisudoc.org/spine_search' +export SpineCGIform='spine_search' +export SpineSQLdb='spine.search.db' +export SpineCGIbin=/var/www/cgi/cgi-bin +export SpineDBpath=/var/www/sqlite +#export SpineDBpath=/srv/www/spine/sqlite +#+END_SRC + +#+BEGIN_SRC sh +#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 +#+END_SRC diff --git a/org/config_git.org b/org/config_git.org index 8c164e9..99f4e57 100644 --- a/org/config_git.org +++ b/org/config_git.org @@ -34,6 +34,7 @@ !*.nix !flake.lock !.envrc +!.envrc-nix !.env !.env/** !README.md diff --git a/org/config_make.org b/org/config_make.org index 7315a8d..ba19a4c 100644 --- a/org/config_make.org +++ b/org/config_make.org @@ -48,6 +48,7 @@ #+HEADER: :tangle ../makefile #+HEADER: :noweb yes #+BEGIN_SRC makefile +include .envrc-local PROG_VER_GIT :=$(shell echo `git describe --long --tags | sed -e "s/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g"`) PROG_VER_DECLARED :=$(shell echo `cat ./views/version.txt | grep --color=never "enum" | sed 's/.\+(\([0-9]\+\),[ \t]\+\([0-9]\+\),[ \t]\+\([0-9]\+\)[ \t]*).\+/\1.\2.\3/g'`) DUB=dub @@ -99,13 +100,15 @@ data/pod/two_bits.christopher_kelty \ data/pod/un_contracts_international_sale_of_goods_convention_1980 \ data/pod/viral_spiral.david_bollier Date := `date "+%Y%m%d"` -SpineBIN := "$${SpineBIN}" # './result/bin' -SpineOUT := "$${SpineOUT}" # '/srv/www/spine' -SpinePOD := "$${SpinePOD}" # '~/grotto/repo/git.repo/projects/doc-reform/data/markup/spine-samples/markup/pod' -SpineSearchActionLocal := 'http://localhost/spine_search' -SpineSearchActionRemote := 'https://sisudoc.org/spine_search' -SpineCGIform := 'spine_search' -SpineSQLdb := 'spine.search.db' +#SpineBIN := $(SpineBIN) # './result/bin' +#SpineOUT := $(SpineOUT) # '/srv/www/spine' +#SpinePOD := $(SpinePOD) # '~/grotto/repo/git.repo/projects/doc-reform/data/markup/spine-samples/markup/pod' +#SpineSearchActionLocal := $(SpineSearchActionLocal) # 'http://localhost/spine_search' +#SpineSearchActionRemote := $(SpineSearchActionRemote) # 'https://sisudoc.org/spine_search' +#SpineCGIform := $(SpineCGIform) # 'spine_search' +#SpineSQLdb := $(SpineSQLdb) # 'spine.search.db' +#SpineCGIbin := $(SpineCGIbin) # '/var/www/cgi/cgi-bin' +#SpineDBpath := "$(SpineDBpath)" # '/var/www/sqlite' hwd := `pwd` gwd := `pwd` + "/src/ext_depends" deps := "`ls -gx './src/ext_depends'`" @@ -130,6 +133,9 @@ nix-devshell: echo -ne '\n❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell"\n\n❯❯ nix build ".#default" --print-build-logs\n❯❯ nix build ".#spine-dmd" --print-build-logs\n❯❯ nix build ".#spine-ldc" --print-build-logs\n❯❯ nix build ".#spine-gdc" --print-build-logs\n\n'; \ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" +# nix build +build: nix-build-default + nix-build-default: nix build ".#default" --print-build-logs @@ -189,58 +195,80 @@ org-tangle: org-tangle *.org; \ cd - +# output local +out-local: + $(SpineBIN)/spine -v \ + --latex --latex-init \ + --epub --html \ + --html-link-search --html-link-pdf --html-link-curate --html-link-markup \ + --cgi-sqlite-search-filename=$(SpineCGIform) --cgi-url-action=$(SpineSearchActionLocal) \ + --sqlite-update --sqlite-db-filename=$(SpineSQLdb) \ + --curate \ + --output=$(SpineOUT) $(SpinePOD)/* + +# output remote +out-remote: + $(SpineBIN)/spine -v \ + --latex --latex-init \ + --epub --html \ + --html-link-search --html-link-pdf --html-link-curate --html-link-markup \ + --cgi-sqlite-search-filename=$(SpineCGIform) --cgi-url-action=$(SpineSearchActionRemote) \ + --sqlite-update --sqlite-db-filename="$(SpineSQLdb)" \ + --curate \ + --output=$(SpineOUT) $(SpinePOD)/* + # epub output out-epub: - $${SpineBIN}/spine -v \ - --epub --output=$${SpineOUT} $${SpinePOD}/* + $(SpineBIN)/spine -v \ + --epub --output=$(SpineOUT) $(SpinePOD)/* # html output with local search links out-html: - $${SpineBIN}/spine -v --generated-by \ + $(SpineBIN)/spine -v --generated-by \ --curate \ - --html --html-link-search --html-link-curate --cgi-url-action="$${SpineSearchActionLocal}" \ - --output=$${SpineOUT} $${SpinePOD}/* + --html --html-link-search --html-link-curate --cgi-url-action=$(SpineSearchActionLocal) \ + --output=$(SpineOUT) $(SpinePOD)/* # latex output out-latex: - $${SpineBIN}/spine -v \ + $(SpineBIN)/spine -v \ --latex \ - --output=$${SpineOUT} $${SpinePOD}/* + --output=$(SpineOUT) $(SpinePOD)/* # odf output out-odf: - $${SpineBIN}/spine -v \ + $(SpineBIN)/spine -v \ --odf \ - --output=$${SpineOUT} $${SpinePOD}/* + --output=$(SpineOUT) $(SpinePOD)/* # sqlite output out-sqlite: - $${SpineBIN}/spine -v \ - --sqlite-update --sqlite-db-filename="$${SpineSQLdb}" \ - --output=$${SpineOUT} $${SpinePOD}/* + $(SpineBIN)/spine -v \ + --sqlite-update --sqlite-db-filename=$(SpineSQLdb) \ + --output=$(SpineOUT) $(SpinePOD)/* # generate markup sample output with local search links output-samples-local: - $${SpineBIN}/spine -v \ + $(SpineBIN)/spine -v \ --latex --latex-init \ --epub \ --html --html-link-search --html-link-pdf --html-link-curate --html-link-markup \ - --cgi-sqlite-search-filename="$${SpineCGIform}" --cgi-url-action="$${SpineSearchActionLocal}" \ + --cgi-sqlite-search-filename=$(SpineCGIform) --cgi-url-action=$(SpineSearchActionLocal) \ --curate \ - --sqlite-update --sqlite-db-filename="$${SpineSQLdb}" \ - --output=$${SpineOUT} $${SpinePOD}/* + --sqlite-update --sqlite-db-filename="$(SpineSQLdb)" \ + --output=$(SpineOUT) $(SpinePOD)/* # generate markup sample output with remote search links output-samples-remote: - $${SpineBIN}/spine -v \ + $(SpineBIN)/spine -v \ --generated-by \ --latex --latex-init \ --epub \ --html --html-link-search --html-link-pdf --html-link-curate \ - --cgi-sqlite-search-filename="$${SpineCGIform}" --cgi-url-action="$${SpineSearchActionRemote}" \ + --cgi-sqlite-search-filename=$(SpineCGIform) --cgi-url-action=$(SpineSearchActionRemote) \ --curate \ - --sqlite-update --sqlite-db-filename="$${SpineSQLdb}" \ - --output=$${SpineOUT} $${SpinePOD}/* + --sqlite-update --sqlite-db-filename=$(SpineSQLdb) \ + --output=$(SpineOUT) $(SpinePOD)/* # generate markup sample output with local search links output-samples: output-samples-local @@ -371,36 +399,36 @@ org-e: # show markup pod source selections markup: - ls -1 --color=always $${SpinePOD} - ls -1 -d --color=always $${SpinePOD}/*/ + ls -1 --color=always $(SpinePOD) + ls -1 -d --color=always $(SpinePOD)/*/ # show markup pod source tree markup-pod-tree: - exa -alT --git -I'.git|.dub|*_' --color=always -L5 $${SpinePOD} | less -R + exa -alT --git -I'.git|.dub|*_' --color=always -L5 $(SpinePOD) | less -R # show markup pod source tree tree-src: - exa -alT --git -I'*_' --color=always -L5 $${SpineSRC}/doc_reform $${SpinePROJ}/views | less -R + exa -alT --git -I'*_' --color=always -L5 $(SpineSRC)/doc_reform $(SpinePROJ)/views | less -R ## show markup pod source tree #tree-src-omit: -# exa -alT --git -I'.git|.dub|*_' --color=always -L5 $${SpineSRC} $${SpinePROJ}/views | less -R +# exa -alT --git -I'.git|.dub|*_' --color=always -L5 $(SpineSRC) $(SpinePROJ)/views | less -R # show markup pod source tree tree-src-search-cgi: - exa -alT --git -I'*_' --color=always -L5 $${SpineSearchCGI}/src $${SpineSearchCGI}/views | less -R + exa -alT --git -I'*_' --color=always -L5 $(SpineSearchCGI)/src $(SpineSearchCGI)/views | less -R # show markup files markup-files: - cd $${SpinePOD}; \ + cd $(SpinePOD); \ find . -type f -iname "*sst"; \ cd -; \ - echo $${SpinePOD} -# find $${SpinePOD}/. -type f -iname "*sst" + echo $(SpinePOD) +# find $(SpinePOD)/. -type f -iname "*sst" # preview markup files vim markup-files-vi: - cd $${SpinePOD}; \ + cd $(SpinePOD); \ fd --max-depth 5 --type file -g "*.ss?" | sort \ | fzf \ --preview='bat --color "always" {}' \ @@ -410,7 +438,7 @@ markup-files-vi: # preview markup files emacs markup-files-e: - cd $${SpinePOD}; \ + cd $(SpinePOD); \ fd --max-depth 5 --type file -g "*.ss?" | sort \ | fzf \ --preview='bat --color "always" {}' \ @@ -430,21 +458,21 @@ markup-samples: markup-pod-samples markup-file-samples # markup samples pod manifests markup-pod-samples: - echo "$${SpinePOD}"; \ - find $${SpinePOD} -name pod.manifest | sort + echo $(SpinePOD); \ + find $(SpinePOD) -name pod.manifest | sort -#find $${SpinePOD} -name pod.manifest | sed -E 's:.+?(([/][^/]+){2})$:\1:' +#find $(SpinePOD) -name pod.manifest | sed -E 's:.+?(([/][^/]+){2})$:\1:' # markup samples sst files markup-file-samples: - echo "$${SpinePOD}"; \ - find $${SpinePOD} -name *.ss[tm] | sort + echo $(SpinePOD); \ + find $(SpinePOD) -name *.ss[tm] | sort # archive spine output (www) spineWWWarchive: cd /srv/www ; \ - rm spine_output.$${Date}.tar.bz2 ; \ - sudo tar --exclude='./spine/latex' --exclude='./spine/pod' --exclude='./spine/*_' -cjf spine_output.$${Date}.tar.bz2 ./spine ; \ + rm spine_output.$(Date).tar.bz2 ; \ + sudo tar --exclude='./spine/latex' --exclude='./spine/pod' --exclude='./spine/*_' -cjf spine_output.$(Date).tar.bz2 ./spine ; \ cd - # rsync archived spine output to Linode @@ -750,12 +778,12 @@ clean_tangle_build: clean tangle build tangle_build: tangle build -build: $(PRG_SRCDIR)/$(PRG_SRC) - $(DC) $(DC_FLAGS) \ - $(DC_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \ - $(PRG_SRCDIR)/$(PRG_SRC) +build-dc: $${PRG_SRCDIR}/$${PRG_SRC} + $${DC} $${DC_FLAGS} \ + $${DC_FLAG_BINOF}$${PRG_BINDIR}/$${PRG_BIN} \ + $${PRG_SRCDIR}/$${PRG_SRC} -rebuild: $(PRG_SRCDIR)/$(PRG_SRC) $(PRG_BINDIR)/$(PRG_BIN).o clean build +rebuild: $${PRG_SRCDIR}/$${PRG_SRC} $${PRG_BINDIR}/$${PRG_BIN}.o clean build makefile_new: make -k tangle_maker diff --git a/org/config_nix.org b/org/config_nix.org index e57d8e6..a12a04f 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -16,59 +16,6 @@ #+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t * nix :nix: -** envrc :envrc: -*** .envrc - -- https://github.com/nix-community/nix-direnv - - source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-0000000000000000000000000000000000000000000=" - -#+HEADER: :tangle ../.envrc -#+BEGIN_SRC sh -NIX_ENFORCE_PURITY=1 -# - https://github.com/nix-community/nix-direnv -NixDirEnvVersion="2.2.1" -NixDirEnvSHA="sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs=" -#NixDirEnvSHAget="sha256-0000000000000000000000000000000000000000000=" -if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then - source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "${NixDirEnvSHA}" -fi -watch_file flake.lock -watch_file flake.nix -watch_file makefile -#if [ -f .envrc-local ]; then -# source_env_if_exists .envrc-local || source .envrc-local -#fi -PATH_add result/bin -use flake . -#use flake .#default -#+END_SRC - -*** .envrc-local CHECK MODIFY - -- bespoke modify appropriately and generate if needed - -#+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=/srv/nix/nixpkgs -#export NIX_PATH=nixpkgs=/srv/nix/nixpkgs -export DFLAGS="-O2 -inline -boundscheck=on -color=on" -export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g') -#export SpineBIN=result/bin -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 SpineOUTversioned=/srv/www/spine/$SpineVER -export SpineDBpath=/var/www/sqlite -#export SpineDBpath=/srv/www/spine/sqlite -export SpineCGIbin=/var/www/cgi/cgi-bin -export SpineSearchActionLocal='http://localhost/spine_search' -export SpineSearchActionRemote='https://sisudoc.org/spine_search' -export SpineCGIform='spine_search' -export SpineSQLdb='spine.search.db' -#+END_SRC - ** flake.nix :flake: #+HEADER: :tangle ../flake.nix @@ -206,32 +153,6 @@ export SpineSQLdb='spine.search.db' 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 SpineOUTversioned=$SpineOUT/$SpineVER - 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 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'`" - export spineNixHelp="cat ./.env/nix-commands" - export spineTest="nix shell .#default --print-build-logs --command spine --very-verbose --epub --html --html-link-search --html-link-curate --curate --output=\"\$SpineOUT\" $SpinePOD/*" - 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 spineEpub="spine --very-verbose --epub --output=\"\$SpineOUT\" $SpinePOD/*" - export spineLatex="spine --very-verbose --latex --output=\"\$SpineOUT\" $SpinePOD/*" - export spinePdf="spine --very-verbose --pdf --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; { @@ -244,7 +165,7 @@ export SpineSQLdb='spine.search.db' packages = [ sqlite dub - dmd + #dmd ldc gnumake ]; @@ -283,7 +204,7 @@ export SpineSQLdb='spine.search.db' inherit devEnv; packages = [ dub - dmd + #dmd ldc gnumake sqlite @@ -296,7 +217,7 @@ export SpineSQLdb='spine.search.db' inherit devEnv; packages = [ dub - dmd + #dmd ldc gnumake sqlite @@ -313,7 +234,7 @@ export SpineSQLdb='spine.search.db' inherit devEnv; packages = [ dub - dmd + #dmd ldc gnumake sqlite @@ -326,7 +247,7 @@ export SpineSQLdb='spine.search.db' inherit devEnv; packages = [ dub - dmd + #dmd ldc gnumake sqlite @@ -398,9 +319,6 @@ with pkgs; # perl534Packages.Po4a ]; shellHook = '' - nix flake update - nix flake check - nix flake show echo ' shell.nix echo ❯❯ @@ -433,7 +351,7 @@ echo "ldc `${pkgs.ldc}/bin/ldc2 -v`" pkgs.callPackage ./devenv.nix {} #+END_SRC -** devenv.nix +** devenv.nix :default:devenv: #+HEADER: :tangle ../devenv.nix #+HEADER: :tangle-mode (identity #o644) @@ -610,6 +528,13 @@ installPhase = '' #+END_SRC ** variables used SET +*** spine version SET VERSION :version:set:project: + +#+NAME: spine_version_set +#+BEGIN_SRC sh +0.12.0 +#+END_SRC + *** nixpkgs path / url - nixpkgs_url_github @@ -629,19 +554,12 @@ github:NixOS/nixpkgs/nixpkgs-unstable /srv/nix/nixpkgs #+END_SRC -*** spine version SET VERSION :version:set:project: - -#+NAME: spine_version_set -#+BEGIN_SRC sh -0.12.0 -#+END_SRC - *** nixpkgs path options - <nixpkgs> -#+HEADER: :noweb yes #+NAME: nixpkgs_url +#+HEADER: :noweb yes #+BEGIN_SRC sh <<nixpkgs_url_github>> #+END_SRC @@ -51,9 +51,6 @@ with pkgs; # perl534Packages.Po4a ]; shellHook = '' - nix flake update - nix flake check - nix flake show echo ' shell.nix echo ❯❯ |