diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2023-04-29 23:19:51 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2023-04-29 23:28:36 -0400 |
commit | 0796fe7d60519f22d0ada2e48561d4abc3d953aa (patch) | |
tree | 6391dcfde7a4d9cc16fbf1a74ef61713068e5dd0 | |
parent | cgi search, cosmetic on sisu spine info (diff) |
nix dev + update direnv 2.2.1 => 2.3.0
-rw-r--r-- | .envrc | 15 | ||||
-rw-r--r-- | .envrc-local_ | 10 | ||||
-rw-r--r-- | .envrc-nix | 17 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | derivation.nix | 6 | ||||
-rw-r--r-- | devenv.nix | 4 | ||||
-rw-r--r-- | flake.lock | 6 | ||||
-rw-r--r-- | flake.nix | 37 | ||||
-rw-r--r-- | makefile | 16 | ||||
-rw-r--r-- | org/config_env.org | 94 | ||||
-rw-r--r-- | org/config_git.org | 1 | ||||
-rw-r--r-- | org/config_make.org | 16 | ||||
-rw-r--r-- | org/config_nix.org | 802 | ||||
-rwxr-xr-x | shell.nix | 7 |
14 files changed, 185 insertions, 847 deletions
@@ -1,15 +1,6 @@ -use flake . -#use flake .#default -NIX_ENFORCE_PURITY=1 -# - https://github.com/nix-community/nix-direnv -NixDirEnvVersion="2.2.1" -if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then -# 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-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs=" -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 +if [ -f .envrc-nix ]; then + source_env_if_exists .envrc-nix || source .envrc-nix +fi diff --git a/.envrc-local_ b/.envrc-local_ index 8b458d8..4d8d1ca 100644 --- a/.envrc-local_ +++ b/.envrc-local_ @@ -1,13 +1,5 @@ -#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 SpinePROJ=~/grotto/repo/git.repo/projects/doc-reform/code/software/spine-search -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 SpineSearchBIN=result/share/cgi-bin export SpineCGIbin=/var/www/cgi/cgi-bin export SpineCGIform='spine_search' -export SpineSQLdb='spine.search.db' 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 diff --git a/derivation.nix b/derivation.nix index 8aee027..feb0fa4 100644 --- a/derivation.nix +++ b/derivation.nix @@ -93,7 +93,6 @@ with ( ); mkDubDerivation rec { name = "spine-search-${version}"; - #version = "0.12.0"; src = ./.; buildInputs = [ pkgs.sqlite @@ -105,11 +104,6 @@ with ( ## compiler ldc rund - ## linker - #lld - #mold - ## builder - #ninja sqlite ] ) @@ -10,7 +10,6 @@ with pkgs; # ❯❯❯ nix_related #nix # if not on NixOS, this is needed direnv - #cachix nixVersions.unstable #nixFlakes nix-prefetch-git validatePkgConfig @@ -19,13 +18,14 @@ with pkgs; jq alejandra git + # ❯❯❯ dev gnumake ps # ❯❯❯ d_build_related # ❯❯ package manager dub # ❯❯ compiler - dmd + #dmd ldc # ❯❯❯ sqlite search related sqlite @@ -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": { @@ -99,13 +99,13 @@ #spine-search-gdc = stdenv.mkDerivation { # inherit pname; # inherit version; - # meta.mainProgram = "spine_search-gdc"; - # executable = true; - # src = self; + # meta.mainProgram = "spine_search-gdc"; + # executable = true; + # src = self; # inherit shell; # inherit devEnv; - # buildInputs = [ sqlite ]; - # nativeBuildInputs = [ dub gdc gnumake ]; + # buildInputs = [ sqlite ]; + # nativeBuildInputs = [ dub gdc gnumake ]; # buildPhase = '' # runHook preBuild # dub build --compiler=$(type -P gdc) --build=gdc --combined --skip-registry=all @@ -122,26 +122,7 @@ 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 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 spineNixHelp="cat ./.env/nix-commands" - 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 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/*" + ## set local values in .envrc-local (or here if you must) ''; in with pkgs; { @@ -149,8 +130,8 @@ name = "spine base dev shell"; inherit shell; inherit devEnv; - #buildInputs = [ sqlite ]; - #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; + #buildInputs = [ sqlite ]; + #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ sqlite dub @@ -166,7 +147,7 @@ inherit devEnv; packages = [ dub - dmd + #dmd ldc gnumake sqlite @@ -1,9 +1,10 @@ -SpineBIN := "${SpineBIN}" # 'result/bin' -SpineOUT := "${SpineOUT}" # '/srv/www/spine' -SpinePOD := "${SpinePOD}" # '~/grotto/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples/markup/pod' -SpineSearchAction := 'https://sisudoc.org/spine_search' -SpineCGIform := 'spine_search' -SpineSQLdb := 'spine.search.db' +include .envrc-local +#SpineBIN := "${SpineBIN}" # 'result/bin' +#SpineOUT := "${SpineOUT}" # '/srv/www/spine' +#SpinePOD := "${SpinePOD}" # '~/grotto/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples/markup/pod' +#SpineSearchAction := 'https://sisudoc.org/spine_search' +#SpineCGIform := 'spine_search' +#SpineSQLdb := 'spine.search.db' default: flake-check @@ -24,8 +25,7 @@ nix-devshell: nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" # nix build -build: - nix-build +build: nix-build-default nix-build-default: nix build ".#default" --print-build-logs diff --git a/org/config_env.org b/org/config_env.org new file mode 100644 index 0000000..fa26a72 --- /dev/null +++ b/org/config_env.org @@ -0,0 +1,94 @@ +-*- 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 SpineSearchBIN=result/share/cgi-bin +export SpineCGIbin=/var/www/cgi/cgi-bin +export SpineCGIform='spine_search' +#+END_SRC diff --git a/org/config_git.org b/org/config_git.org index 460b91d..967b9d2 100644 --- a/org/config_git.org +++ b/org/config_git.org @@ -32,6 +32,7 @@ !*.nix !flake.lock !.envrc +!.envrc-nix !.env !.env/** !README.md diff --git a/org/config_make.org b/org/config_make.org index 6e20002..d439806 100644 --- a/org/config_make.org +++ b/org/config_make.org @@ -47,12 +47,13 @@ #+HEADER: :tangle ../makefile #+HEADER: :noweb yes #+BEGIN_SRC makefile -SpineBIN := "${SpineBIN}" # 'result/bin' -SpineOUT := "${SpineOUT}" # '/srv/www/spine' -SpinePOD := "${SpinePOD}" # '~/grotto/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples/markup/pod' -SpineSearchAction := 'https://sisudoc.org/spine_search' -SpineCGIform := 'spine_search' -SpineSQLdb := 'spine.search.db' +include .envrc-local +#SpineBIN := "${SpineBIN}" # 'result/bin' +#SpineOUT := "${SpineOUT}" # '/srv/www/spine' +#SpinePOD := "${SpinePOD}" # '~/grotto/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples/markup/pod' +#SpineSearchAction := 'https://sisudoc.org/spine_search' +#SpineCGIform := 'spine_search' +#SpineSQLdb := 'spine.search.db' default: flake-check @@ -73,8 +74,7 @@ nix-devshell: nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" # nix build -build: - nix-build +build: nix-build-default nix-build-default: nix build ".#default" --print-build-logs diff --git a/org/config_nix.org b/org/config_nix.org index fe72d99..3f990dc 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -16,146 +16,7 @@ #+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t * nix :nix: - -#+NAME: nixpkgs_local -#+BEGIN_SRC sh -/srv/nix/nixpkgs -#+END_SRC - -** NOTES -*** nix-shell - -- default.nix - -#+BEGIN_SRC sh -nix-shell -nix-build -#+END_SRC - -- project.nix - -#+BEGIN_SRC sh -nix-shell -nix-build project.nix -#+END_SRC - -*** nix-shell --pure - -- default.nix - -#+HEADER: :noweb yes -#+BEGIN_SRC sh -nix-shell --pure -nix-build -I nixpkgs=<<nixpkgs_local>> -nix-build -I .envrc -#+END_SRC - -#+BEGIN_SRC sh -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 build -f project.nix -# nix build -f spine.nix -nix develop --build -f derivation.nix -I .envrc --print-build-logs -#+END_SRC - -*** derivation .drv - -#+BEGIN_SRC sh -nix show-derivation /nix/store/q7n14bm8j5vzm62qaraczdb4bpyf59vv-spine-0.11.1.drv -#+END_SRC - -** spine - -- default.nix -- shell.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 -use flake . -#use flake .#default -NIX_ENFORCE_PURITY=1 -# - https://github.com/nix-community/nix-direnv -NixDirEnvVersion="2.2.1" -if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then -# 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-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs=" -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 -#+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 SpinePROJ=~/grotto/repo/git.repo/projects/doc-reform/code/software/spine-search -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 SpineCGIbin=/var/www/cgi/cgi-bin -export SpineCGIform='spine_search' -export SpineSQLdb='spine.search.db' -#+END_SRC - -*** makefile - -#+HEADER: :tangle ../makefile_ -#+BEGIN_SRC make -buildPhase: - HOME=$${PWD}; \ - for DC_ in dmd ldmd2 gdmd; do \ - echo "- check for D compiler $${DC_}"; \ - DC=$$(type -P $${DC_} || echo ""); \ - if [ ! "$${DC}" == "" ]; then \ - break; \ - fi; \ - done; \ - echo "D compiler = $${DC}"; \ - if [ "$${DC}" == "" ]; then \ - echo "Error: could not find D compiler"; \ - exit 1; \ - fi; \ - echo "$${DC_} used as D compiler to build $${pname}"; \ - export DFLAGS="-O2 -inline"; \ - dub build --compiler=$${DC} --build=release --combined --skip-registry=all; -checkPhase: - runHook preCheck; \ - HOME=$${PWD}; \ - dub test --combined --skip-registry=all; \ - runHook postCheck -installPhase: - runHook preInstall; \ - mkdir -p $${out}/bin; \ - install -m755 ./bin/spine $${out}/bin/spine; \ - runHook postInstall - #cp -r bin/spine $out/bin/. -postInstall: - echo "$${out}/share/cgi-bin"; \ - echo `ls -la $${out}/bin/spine` -#+END_SRC - -*** flake :flake: -**** flake.nix +** flake.nix :flake: #+HEADER: :tangle ../flake.nix #+HEADER: :noweb yes @@ -170,7 +31,7 @@ postInstall: flake-utils, } @ inputs: let pname = "spine_search"; - version = "0.12.0"; + version = "<<spine_version_set>>"; shell = ./shell.nix; # ./default.nix; devEnv = ./.envrc; # ./shell.nix; # ./default.nix; supportedSystems = ["x86_64-linux"]; # [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; @@ -261,13 +122,13 @@ postInstall: #spine-search-gdc = stdenv.mkDerivation { # inherit pname; # inherit version; - # meta.mainProgram = "spine_search-gdc"; - # executable = true; - # src = self; + # meta.mainProgram = "spine_search-gdc"; + # executable = true; + # src = self; # inherit shell; # inherit devEnv; - # buildInputs = [ sqlite ]; - # nativeBuildInputs = [ dub gdc gnumake ]; + # buildInputs = [ sqlite ]; + # nativeBuildInputs = [ dub gdc gnumake ]; # buildPhase = '' # runHook preBuild # dub build --compiler=$(type -P gdc) --build=gdc --combined --skip-registry=all @@ -284,26 +145,7 @@ postInstall: 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 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 spineNixHelp="cat ./.env/nix-commands" - 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 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/*" + ## set local values in .envrc-local (or here if you must) ''; in with pkgs; { @@ -311,8 +153,8 @@ postInstall: name = "spine base dev shell"; inherit shell; inherit devEnv; - #buildInputs = [ sqlite ]; - #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; + #buildInputs = [ sqlite ]; + #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ sqlite dub @@ -328,7 +170,7 @@ postInstall: inherit devEnv; packages = [ dub - dmd + #dmd ldc gnumake sqlite @@ -341,155 +183,7 @@ postInstall: } #+END_SRC -*** flake :flake: -**** notes? - -- flake.nix - /srv/nix/nixpkgs - ./shell.nix - - shell.nix - ./pkgs/shell-pkgs.nix - - pkgs/shell-pkgs.nix - - default.nix - ./nix/dub.selections.nix # - - dub.selections.nix - -- nix develop - -- nix flake update - -- nix shell -f default.nix --print-build-logs -- nix shell -c default.nix - -- nix build `nix-instantiate` -- 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 develop --profile .#default --print-build-logs --command spine -v - -- nix search --json 2>/dev/null |jq -- nix flake show -- nix show-derivation - -# nix-instantiate | nix-build - -#nix flake update -#nix flake check -#nix flake show -#nix develop -#nix build .#default --print-build-logs - -#+BEGIN_SRC nix -src = fetchTarball { - url = "file:///[path]/$(pname)-$(version).tar.gz"; - sha256 = "sha256:0000000000000000000000000000000000000000000000000000"; -}; -#+END_SRC - -**** flake parts -***** flake metadata - -#+NAME: flake_metadata -#+HEADER: :noweb yes -#+BEGIN_SRC nix -pname = "spine_search"; -version = "<<spine_version_set>>"; -description = "a sisu like document parser search form"; -#+END_SRC - -***** flake inputs -****** flake inputs static - -#+NAME: flake_inputs_nix -#+HEADER: :noweb yes -#+BEGIN_SRC nix -nixpkgs.url = "github:nixos/nixpkgs"; -flake-utils.url = "github:numtide/flake-utils"; -#+END_SRC - -***** flake outputs -****** flake outputs static - -#+NAME: flake_outputs -#+HEADER: :noweb yes -#+BEGIN_SRC nix -self, nixpkgs, flake-utils -#+END_SRC - -***** flake devshells - -#+NAME: flake_devshells -#+HEADER: :noweb yes -#+BEGIN_SRC nix -devShells = forAllSystems (system: - let pkgs = nixpkgsFor.${system}; - in { - default = pkgs.mkShell { - buildInputs = with pkgs; [ git dub dmd ldc sqlite ]; - }; -}); -#+END_SRC - -***** flake phases - -#+NAME: flake_phases -#+HEADER: :noweb yes -#+BEGIN_SRC nix -buildPhase = '' - runHook preBuild - HOME="$PWD" - for DC_ in dmd ldmd2 ldc2 gdc gdmd; do - echo "- check for D compiler $DC_" - DC=$(type -P $DC_ || echo "") - if [ ! "$DC" == "" ]; then break; fi - done - if [ "$DC" == "" ]; then exit "Error: could not find D compiler"; fi - echo "$DC_ used as D compiler to build $pname" - dub build --compiler=$DC --build=$DC_ --combined --skip-registry=all - runHook postBuild -''; -<<flake_phases_other_than_buildPhase>> -#+END_SRC - -#+NAME: flake_phases_other_than_buildPhase -#+HEADER: :noweb yes -#+BEGIN_SRC nix -checkPhase = '' - runHook preCheck - dub test --combined --skip-registry=all - runHook postCheck -''; -installPhase = '' - runHook preInstall - mkdir -p $out/share/cgi-bin - install -m755 -D ./cgi-bin/spine_search $out/share/cgi-bin/spine_search - runHook postInstall -''; -postInstall = '' - echo `ls -la $out/share/cgi-bin/spine_search` - echo " - nix build or nix develop? (suggestions): - - nix build - nix build .#default --print-build-logs - nix flake update; nix build .#default --print-build-logs - nix build --print-build-logs - - nix run - nix run .#default --print-build-logs - nix run default.nix --print-build-logs - - nix shell - nix shell .#default --print-build-logs --command spine -v - - nix develop - nix develop --profile .#default --print-build-logs --command spine -v - nix develop ; eval \"$buildPhase\" - nix develop --build -f derivation.nix -I .envrc --print-build-logs - - nix profile install . --print-build-logs - nix-instantiate | nix show-derivation | jq - " -''; -#+END_SRC - -*** shell.nix :shell: -**** tangle +** shell.nix :shell: #+HEADER: :tangle ../shell.nix #+HEADER: :tangle-mode (identity #o755) @@ -503,7 +197,6 @@ with pkgs; # ❯❯❯ nix_related #nix direnv - #cachix nixVersions.unstable #nixFlakes nix-prefetch-git validatePkgConfig @@ -512,6 +205,7 @@ with pkgs; jq alejandra git + # ❯❯❯ dev gnumake ps # ❯❯❯ d_build_related @@ -519,7 +213,7 @@ with pkgs; dub # ❯❯ compiler ldc - rund + #rund # ❯❯ linker #lld #mold @@ -532,9 +226,6 @@ with pkgs; #aria #wget #curl ]; shellHook = '' - nix flake update - nix flake check - nix flake show echo ' shell.nix echo ❯❯ @@ -556,152 +247,7 @@ with pkgs; echo "ldc `${pkgs.ldc}/bin/ldc2 -v`" -**** Notes - -#+BEGIN_SRC text -#% Notes - -# - shell.nix -I .envrc -# - shell.nix -I .envrc --pure - -# [ nix-shell ] - - # - nix-shell -I nixpkgs=/srv/nix/nixpkgs --pure - # - nix-shell -p "with import /srv/nix/nixpkgs {}; ldc" --pure - # - nix-shell -p "with import /srv/nix/nixpkgs {}; [dub ldc]" --pure - - # - nix-shell -p nixVersions.unstable #nixFlakes - # - nix-shell -p nixFlakes --pure - # - nix-shell -p nixFlakes --pure -p "with import /srv/nix/nixpkgs {}; [nix dub ldc git ps]" - # - nix-shell shell.nix direnv: export +IN_NIX_SHELL - # - nix-shell shell.nix - -# [ nix-build ] - - # - nix-build -I nixpkgs=/srv/nix/nixpkgs # --pure - # - nix-build -I .envrc --pure - # - nix-build default.nix -I .envrc && result/bin/spine -v - -# [ nix-instantiate ] - - # - 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 ] - - # - nix shell -c default.nix - # - nix shell -f default.nix --print-build-logs - -# [ nix build ] - - # - 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 `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 build .#default - -# [ nix run ] - - # - nix run default.nix --print-build-logs - # - nix run -I .envrc default.nix --print-build-logs - # - nix run .#default - -# - nix-shell -I .envrc --pure -# - nix develop --build -f derivation.nix -I .envrc --print-build-logs - -# - nix-shell -p nixFlakes --pure -p "with import /srv/nix/nixpkgs {}; [nix dub ldc git ps]" -# - nix-build -# - nix build `nix-instantiate -I .envrc` - -# - nix develop --build -f default.nix -I .envrc - -# - nix-shell -I .envrc --pure -# - nix-build default.nix -I .envrc && result/bin/spine -v - -# - nix shell -f default.nix --print-build-logs -# - nix-instantiate -I .envrc | nix-build -I .envrc -#+END_SRC - -#+BEGIN_SRC text -#% Notes -- nix-shell - -- shell.nix --pure -- shell.nix --pure -I .envrc - -- nix-shell --pure -I nixpkgs=<<nixpkgs_local>> -- nix-shell --pure -p "with import <<nixpkgs_local>> {}; ldc" -- nix-shell --pure -p "with import /srv/nix/nixpkgs {}; [dub ldc]" - -- shell.nix direnv: export +IN_NIX_SHELL - -- nix-shell -p nixFlakes -- nix-shell -p nixFlakes --pure -- nix-shell -p nixFlakes --pure -p "with import /srv/nix/nixpkgs {}; [dub ldc]" - -- shell.nix -I .envrc -- nix-shell -I nixpkgs=<provide local nix path> -- nix-shell -I nixpkgs=<provide local nix path> --pure -- shell.nix -- nix-shell shell.nix --pure - -- nix shell -c default.nix - -- nix run default.nix --print-build-logs -- nix run -I .envrc default.nix --print-build-logs - -- nix develop - -- nix-build -I nixpkgs=<provide local nix path> -- nix-build -I .envrc - -- 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 -#+END_SRC - -*** default.nix :default: - -- default.nix -I nixpkgs=<provide local nix path> - e.g. default.nix -I nixpkgs=/srv/nix/nixpkgs - -- nix-build -I nixpkgs=<provide local nix path> - e.g. nix-build -I nixpkgs=<<nixpkgs_local>> - -#+HEADER: :noweb yes -#+BEGIN_SRC sh -nix-build -I nixpkgs=<<nixpkgs_local>> -nix-build -I .envrc-local -nix-build -I .envrc -default.nix -I .envrc -default.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 +** default.nix :default: #+HEADER: :tangle ../default.nix #+HEADER: :tangle-mode (identity #o755) @@ -735,7 +281,6 @@ with pkgs; # ❯❯❯ nix_related #nix # if not on NixOS, this is needed direnv - #cachix nixVersions.unstable #nixFlakes nix-prefetch-git validatePkgConfig @@ -744,13 +289,14 @@ with pkgs; jq alejandra git + # ❯❯❯ dev gnumake ps # ❯❯❯ d_build_related # ❯❯ package manager dub # ❯❯ compiler - dmd + #dmd ldc # ❯❯❯ sqlite search related sqlite @@ -771,7 +317,7 @@ with pkgs; } #+END_SRC -*** derivation.nix :default: +** derivation.nix :default: #+HEADER: :tangle ../derivation.nix #+HEADER: :tangle-mode (identity #o644) @@ -872,7 +418,6 @@ with ( ); mkDubDerivation rec { name = "spine-search-${version}"; - #version = "0.12.0"; src = ./.; buildInputs = [ pkgs.sqlite @@ -884,18 +429,13 @@ with ( ## compiler ldc rund - ## linker - #lld - #mold - ## builder - #ninja sqlite ] ) ]; meta = with pkgs.lib; { pname = "spine-search"; - version = "0.12.0"; + version = "<<spine_version_set>>"; homepage = "https://sisudoc.org"; description = "cgi sqlite search form for document object search"; longDescription = '' @@ -920,125 +460,7 @@ installPhase = '' ''; #+END_SRC -*** project meta - -#+NAME: nix_project_meta -#+HEADER: :noweb yes -#+BEGIN_SRC nix -meta = with pkgs.lib; { - pname = "spine"; - version = "<<spine_version_set>>"; - description = "a sisu like document parser"; - longDescription = '' - A sisu like parser and document generator - ''; - homepage = "https://sisudoc.org"; - license = licenses.agpl3Plus; - platforms = platforms.linux; - maintainers = [ "RalphAmissah" ]; -}; -#+END_SRC - -*** dub.selections.json - -#+HEADER: :NO-tangle ../dub.selections.json -#+BEGIN_SRC nix -{ - "fileVersion": 1, - "versions": { - "d2sqlite3": "0.19.1", - "dyaml": "0.8.3", - "imageformats": "7.0.2", - "tinyendian": "0.2.0" - } -} -#+END_SRC - -*** dub.selections.nix - -#+HEADER: :NO-tangle ../nix/dub.selections.nix -#+BEGIN_SRC nix -# This file was generated by https://github.com/lionello/dub2nix v0.2.3 -[ { - fetch = { - type = "git"; - url = "https://github.com/dlang-community/d2sqlite3.git"; - rev = "v0.19.1"; - sha256 = "0rnsgla6xyr8r34knf7v6dwhacra96q1b5rhxcz9246inwhvrk5k"; - fetchSubmodules = false; - date = "2020-07-21T12:32:51+02:00"; - deepClone = false; - leaveDotGit = false; - path = "/nix/store/hsi8xvl15w6fwlqvs042m1z5i88yc72i-d2sqlite3"; - }; -} { - fetch = { - type = "git"; - url = "https://github.com/kiith-sa/tinyendian.git"; - rev = "v0.2.0"; - sha256 = "086gf5aga52wr5rj2paq54daj8lafn980x77b706vvvqaz2mlis8"; - fetchSubmodules = false; - date = "2018-06-10T11:04:28+02:00"; - deepClone = false; - leaveDotGit = false; - path = "/nix/store/9c7fsmi5am84j6dq2mp3va306x3ay291-tinyendian"; - }; -} { - fetch = { - type = "git"; - url = "https://github.com/kiith-sa/D-YAML.git"; - rev = "v0.8.3"; - sha256 = "13wy304xjbwkpgg7ilql1lkxkm83s87jm59ffnrg26slp7cx149q"; - fetchSubmodules = false; - date = "2020-09-19T23:46:57+02:00"; - deepClone = false; - leaveDotGit = false; - path = "/nix/store/3i8i56lkmw2xq3lxr5h66v909waq2mqg-D-YAML"; - }; -} { - fetch = { - type = "git"; - url = "https://github.com/lgvz/imageformats.git"; - rev = "v7.0.2"; - sha256 = "1mfbsmi4fs1xny4zqs6jyr04d5f4h03r9f6jadvkdqj5kd1k0ws7"; - fetchSubmodules = false; - date = "2019-10-10T07:54:45+03:00"; - deepClone = false; - leaveDotGit = false; - path = "/nix/store/wn554pn21nzmpvw2hs7hvv9v9y0sgarg-imageformats"; - }; -} ] -#+END_SRC - -*** dub2nix & shared pkgs SHARED -**** dub2nix with pkgs shared - -#+NAME: nix_with_pkgs -#+HEADER: :noweb yes -#+BEGIN_SRC nix -with pkgs; [ - <<nix_shell_with_pkgs_list>> -] -#+END_SRC - -**** with pkgs list - -#+NAME: nix_shell_with_pkgs_list -#+BEGIN_SRC nix -nixVersions.unstable #nixFlakes -rund -dub -ldc -sqlite -nix-prefetch-git -validatePkgConfig -nix-output-monitor -nix-tree -jq -git -#+END_SRC - -** variables +** variables used SET *** spine version SET VERSION :version:set:project: #+NAME: spine_version_set @@ -1046,193 +468,41 @@ git 0.12.0 #+END_SRC -*** set names SET +*** nixpkgs path / url -#+NAME: spine_search_db -#+BEGIN_SRC sh -spine.search.db -#+END_SRC +- nixpkgs_url_github +- nixpkgs_url_local -#+NAME: spine_search_cgi +**** github (official) + +#+NAME: nixpkgs_url_github #+BEGIN_SRC sh -spine_search +github:NixOS/nixpkgs/nixpkgs-unstable #+END_SRC -*** nixpkgs_path SETUP -**** nixpkgs select path SELECT +**** localhost -#+NAME: nixpkgs_path -#+HEADER: :noweb yes -#+BEGIN_SRC nix -<<nixpkgs_path_local>> +#+NAME: nixpkgs_url_local +#+BEGIN_SRC sh +/srv/nix/nixpkgs #+END_SRC -**** nixpkgs path options +*** nixpkgs path options - <nixpkgs> -#+NAME: nixpkgs_path_default -#+HEADER: :noweb yes -#+BEGIN_SRC nix -<nixpkgs> -#+END_SRC - -#+NAME: nix_path_directory -#+HEADER: :noweb yes -#+BEGIN_SRC nix -nixpkgs=<<nixpkgs_path_local>> -#+END_SRC - -#+NAME: project_path_local_project -#+HEADER: :noweb yes -#+BEGIN_SRC nix -~/grotto/repo/git.repo/projects/project-spine/doc-reform -#+END_SRC - -#+NAME: project_path_local_src -#+HEADER: :noweb yes -#+BEGIN_SRC nix -<<project_path_local_project>>/src -#+END_SRC - -#+NAME: project_path_local_bin -#+HEADER: :noweb yes -#+BEGIN_SRC nix -<<project_path_local_project>>/result/bin -#+END_SRC - -#+NAME: project_path_cgi_bin -#+BEGIN_SRC nix -/var/www/cgi/cgi-bin -#+END_SRC - -#+NAME: project_path_local_doc -#+BEGIN_SRC nix -~/grotto/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples -#+END_SRC - -#+NAME: project_path_local_out -#+BEGIN_SRC nix -/srv/www/spine/$SpineVER -#+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 +#+NAME: nixpkgs_url #+HEADER: :noweb yes -#+BEGIN_SRC nix -/srv/www/spine -#+END_SRC - -#+NAME: project_path_local_out_static_ -#+BEGIN_SRC nix -/var/www -#+END_SRC - -#+NAME: project_path_sqlite -#+BEGIN_SRC nix -/var/www/sqlite +#+BEGIN_SRC sh +<<nixpkgs_url_github>> #+END_SRC -#+NAME: nixpkgs_url +#+NAME: nixpkgs_url_github #+BEGIN_SRC nix github:nixos/nixpkgs #+END_SRC -#+HEADER: :noweb yes -#+BEGIN_SRC nix -<<nixpkgs_path_local>> -#+END_SRC - -- local path SET WARN - #+NAME: nixpkgs_path_local #+BEGIN_SRC nix /srv/nix/nixpkgs #+END_SRC - -**** project path options - -- local path SET WARN - -#+NAME: nix_path_channel -#+BEGIN_SRC nix -/nix/var/nix/profiles/per-user/root/channels/nixos -#+END_SRC - -** texlive xetex xelatex shell.nix -*** shell.nix :shell: - -#+BEGIN_SRC nix -#!/usr/bin/env -S nix-shell --pure -{ pkgs ? import <nixpkgs> {} }: -pkgs.mkShell { - buildInputs = with pkgs; [ - nixVersions.unstable #nixFlakes - nix-prefetch-git - validatePkgConfig - nix-output-monitor - nix-tree - jq - git - fontconfig - source-sans-pro - source-serif-pro - source-code-pro - #(texlive.combine { - # inherit (texlive) scheme-tetex xetex fontspec footmisc multirow titlesec listings anysize float graphics helvetic times courier; - #}) - texlive.combined.scheme-full - dejavu_fonts dejavu_fontsEnv - liberation_ttf - evince - zathura - apvlv - ]; - #FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ - # liberation_ttf - #]; - shellHook = '' - if [[ -f ".envrc" ]]; then - source .envrc - fi - #for texfile in *.tex; do xelatex -interaction=nonstopmode $texfile; done - #for texfile in *.tex; do xelatex -interaction=batchmode $texfile; done - ''; -} -#+END_SRC - -*** notes - -#+BEGIN_SRC sh -nix-shell --run 'which xetex' -echo 'for texfile in *.tex; do echo "* --> " ~ $texfile && xelatex -interaction=batchmode $texfile; rm *.aux *.log *.toc *.out; done' - -$SpineBIN/spine --latex --serial --output="$SpineOUT" $SpinePOD/* && for texfile in $SpineOUT/latex/*.tex; do xelatex -interaction=nonstopmode $texfile; done 2>&1 | tee _err.xelatex_.org; ls $SpineOUT/latex/*.{tex,pdf} - -/run/current-system/sw/share/X11/fonts/ - -kpsewhich pdftexconfig.tex -/nix/store/2r4qa8rbll085nmpx56jg1rbmbir1zkp-texlive-combined-2021/share/texmf/tex/generic/tex-ini-files/pdftexconfig.tex -/nix/store/2r4qa8rbll085nmpx56jg1rbmbir1zkp-texlive-combined-2021/share/texmf/fonts/opentype/public/ - -find: texclive-fonts.conf -fc-cache && mkfontscale && mkfontdir - -fc-match LiberationSans - -cd /nix/var/nix/profiles/system/sw/share/X11/fonts -fc-query LiberationSans-Regular.ttf | grep '^\s\+family:' | cut -d'"' -f2 -Liberation Sans -fc-query LiberationMono-Regular.ttf | grep '^\s\+family:' | cut -d'"' -f2 -Liberation Mono - -fc-query DejaVuSans.ttf | grep '^\s\+family:' | cut -d'"' -f2 - -$XDG_DATA_HOME/fonts -~/.local/share/fonts -#+END_SRC @@ -7,7 +7,6 @@ with pkgs; # ❯❯❯ nix_related #nix direnv - #cachix nixVersions.unstable #nixFlakes nix-prefetch-git validatePkgConfig @@ -16,6 +15,7 @@ with pkgs; jq alejandra git + # ❯❯❯ dev gnumake ps # ❯❯❯ d_build_related @@ -23,7 +23,7 @@ with pkgs; dub # ❯❯ compiler ldc - rund + #rund # ❯❯ linker #lld #mold @@ -36,9 +36,6 @@ with pkgs; #aria #wget #curl ]; shellHook = '' - nix flake update - nix flake check - nix flake show echo ' shell.nix echo ❯❯ |