-*- mode: org -*- #+TITLE: configuration nix #+DESCRIPTION: configuration nix #+FILETAGS: :spine:build:tools: #+AUTHOR: Ralph Amissah #+EMAIL: [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]] #+COPYRIGHT: Copyright (C) 2015 (continuously updated, current 2026) Ralph Amissah #+LANGUAGE: en #+STARTUP: show4levels hideblocks hidestars noindent entitiespretty #+PROPERTY: header-args :exports code #+PROPERTY: header-args+ :noweb yes #+PROPERTY: header-args+ :results silent #+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 * nix :nix: ** flake.nix :flake: #+HEADER: :tangle ../flake.nix #+HEADER: :noweb yes #+BEGIN_SRC nix { description = "a sisu like parser & document generator"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; outputs = { self, nixpkgs, ... }@inputs: let pname = "spine"; version = "<>"; supportedSystems = ["x86_64-linux"]; # [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); # nixpkgs instantiated for supported system types localOverlay = (final: prev: { ldc = prev.callPackage ./nix-overlays/ldc { }; # -> ok <> # dmd overlay: revert to GCC14; (current) GCC 15 introduced nullptr in its headers, and DMD's ImportC parser needs update to handle it, monitor and update: dmd = prev.callPackage ./nix-overlays/dmd { stdenv = prev.gcc14Stdenv; }; # -> ok <> dub = prev.callPackage ./nix-overlays/dub { }; # -> ? <> dtools = prev.callPackage ./nix-overlays/dtools { }; # -> ok <> #gdc = prev.callPackage ./nix-overlays/gdc { }; }); pkgsForSystem = system: import nixpkgs { overlays = [ localOverlay ]; inherit system; }; mkSpine = { pkgs, compilerPkg, compilerBin, buildType }: pkgs.stdenv.mkDerivation { inherit pname version; meta.mainProgram = "spine"; executable = true; # not used src = self; buildInputs = [ pkgs.sqlite ]; nativeBuildInputs = [ pkgs.dub compilerPkg pkgs.gnumake ]; preBuild = '' export HOME=$TMPDIR ''; buildPhase = '' runHook preBuild buildCMD="dub run --cache=local --compiler=$(type -P ${compilerBin}) --build=${buildType} --combined --skip-registry=all" echo $buildCMD $buildCMD echo $buildCMD runHook postBuild ''; checkPhase = '' runHook preCheck dub test --combined --skip-registry=all runHook postCheck ''; installPhase = '' runHook preInstall mkdir -p $out/bin install -m755 ./bin/spine $out/bin/spine runHook postInstall ''; postInstall = '' echo "❯❯ ./result/bin/spine -v --source --pod --text --epub --html --html-link-pdf --html-link-curate --html-link-markup --curate --output=./OUTPUT_TEST_sisudocSpine ../sisu-spine-samples/markup/pod/*"; echo `ls -la $out/bin/spine` echo "❯❯ spine-v${version} (rev: ${self.shortRev or "unknown"})" $out/bin/spine -v ''; }; shellHook = '' #export Date=`date "+%Y%m%d"` ## set local values in .envrc-local (or here if you must) echo '❯❯ nix build'; ## ImPure Nix environment SpineGitVer=`git describe | sed "s/^[a-z_-]\+\([0-9.]\+\)/\1/" | sed "s/\([^-]*-g\)/r\1/" | sed "s/-/./g"` && \ SpineGitBranch=`git branch --show-current` && \ echo "❯❯ spine-v${version} - ($SpineGitBranch: $SpineGitVer)" ## Pure Nix environment - version info from flake inputs #echo "❯❯ spine-v${version} (rev: ${self.shortRev or "unknown"})" echo '❯❯ $SpineBIN -v --source --pod --text --epub --html --html-link-pdf --html-link-curate --html-link-markup --curate --output=$SpineOUT $SpinePOD/*'; echo "❯❯ $SpineBIN -v --source --pod --text --epub --html --html-link-pdf --html-link-curate --html-link-markup --curate --output=$SpineOUT $SpinePOD/*"; echo '❯❯ nix flake update && nix flake check && nix flake show'; ''; mkDevShell = { pkgs, name, compiler, extraPackages ? [] }: pkgs.mkShell { inherit name shellHook; packages = [ pkgs.direnv pkgs.nix-direnv compiler pkgs.dub pkgs.dtools pkgs.gnumake pkgs.sqlite pkgs.gnugrep pkgs.gnused pkgs.ripgrep ] ++ extraPackages; }; in { packages = forAllSystems (system: let pkgs-ovl = pkgsForSystem system; pkgs-nix = nixpkgsFor.${system}; in { default = self.packages.${system}.spine-nixpkgs-ldc; spine-nixpkgs-dmd = mkSpine { pkgs = pkgs-nix; # nixpkgs dmd: revert to GCC14 (same nullptr/ImportC fix as overlay dmd) compilerPkg = pkgs-nix.dmd.override { stdenv = pkgs-nix.gcc14Stdenv; }; #compilerPkg = pkgs-nix.dmd; compilerBin = "dmd"; buildType = "dmd"; }; spine-nixpkgs-ldc = mkSpine { pkgs = pkgs-nix; compilerPkg = pkgs-nix.ldc; compilerBin = "ldmd2"; buildType = "ldmd2"; }; spine-overlay-dmd = mkSpine { pkgs = pkgs-ovl; compilerPkg = pkgs-ovl.dmd; compilerBin = "dmd"; buildType = "dmd"; }; spine-overlay-ldc = mkSpine { pkgs = pkgs-ovl; compilerPkg = pkgs-ovl.ldc; compilerBin = "ldmd2"; buildType = "ldmd2"; }; #spine-overlay-gdc = mkSpine { # pkgs = pkgs-ovl; # compilerPkg = pkgs-ovl.gdc; # compilerBin = "gdc"; # buildType = "gdc"; #}; }); apps = forAllSystems (system: { default = { type = "app"; program = "${self.packages.${system}.default}/bin/spine"; }; }); devShells = forAllSystems (system: let pkgs-ovl = pkgsForSystem system; pkgs-nix = nixpkgsFor.${system}; in { default = self.devShells.${system}.dsh-overlay; #default = import ./shell.nix {pkgs = pkgs-nix; flake = self;}; dsh-overlay = mkDevShell { pkgs = pkgs-ovl; # "spine-<> base dev shell, ldc-<>, dub-<> - dtools-<>"; name = "spine-${version} dev shell (overlay ldc)"; compiler = pkgs-ovl.ldc; }; dsh-nixpkgs-dmd = mkDevShell { pkgs = pkgs-nix; name = "spine-${version} dev shell (nixpkgs dmd)"; # nixpkgs dmd: revert to GCC14 (same nullptr/ImportC fix as overlay dmd) compiler = pkgs-nix.dmd.override { stdenv = pkgs-nix.gcc14Stdenv; }; #compiler = pkgs-nix.dmd; }; dsh-nixpkgs-ldc = mkDevShell { pkgs = pkgs-nix; name = "spine-${version} dev shell (nixpkgs ldc)"; compiler = pkgs-nix.ldc; }; dsh-overlay-dmd = mkDevShell { pkgs = pkgs-ovl; # "spine-<> base dev shell, dmd-<>, dub-<> - dtools-<>"; name = "spine-${version} dev shell (overlay dmd)"; compiler = pkgs-ovl.dmd; }; dsh-overlay-ldc = mkDevShell { pkgs = pkgs-ovl; # "spine-<> base dev shell, ldc-<>, dub-<> - dtools-<>"; name = "spine-${version} dev shell (overlay ldc)"; compiler = pkgs-ovl.ldc; }; dsh-epub = mkDevShell { pkgs = pkgs-nix; name = "spine-${version} dev shell for epub output"; compiler = pkgs-nix.ldc; extraPackages = with pkgs-nix; [ libxml2 html-tidy xmlstarlet epubcheck ebook_tools epr sigil calibre #(suite includes: ebook-viewer) koreader foliate ]; }; dsh-html = mkDevShell { pkgs = pkgs-nix; name = "spine-${version} dev shell for html output"; compiler = pkgs-nix.ldc; extraPackages = with pkgs-nix; [ # ❯❯ text-mode web browsers elinks links2 lynx w3m # ❯❯ light graphical #dillo ]; }; dsh-latex-pdf = mkDevShell { pkgs = pkgs-nix; name = "spine-${version} dev shell for latex & pdf output"; compiler = pkgs-nix.ldc; extraPackages = with pkgs-nix; [ source-sans-pro source-serif-pro source-code-pro texlive.combined.scheme-full ]; }; dsh-sqlite = mkDevShell { pkgs = pkgs-nix; name = "spine-${version} dev shell for sqlite3 output"; compiler = pkgs-nix.ldc; }; dsh-i18n = mkDevShell { pkgs = pkgs-nix; name = "spine-${version} dev shell for internationalization, po4a"; compiler = pkgs-nix.ldc; extraPackages = with pkgs-nix; [ perlPackages.Po4a ]; }; }); }; } #+END_SRC ** shell.nix :shell: #+HEADER: :tangle ../shell.nix #+HEADER: :tangle-mode (identity #o755) #+HEADER: :shebang "#!/usr/bin/env -S nix-shell --pure\n#!nix-shell -i bash" #+HEADER: :noweb yes #+BEGIN_SRC nix # Development environment for sisudoc-spine. # Builds the spine binary via ./package.nix and puts it on PATH. # # Build logic for the spine derivation lives in ./package.nix # this file only describes the dev shell. # # Usage: # nix-shell # enters shell, builds spine # nix-shell --run 'spine --version' # runs spine after build { pkgs ? import {}, spine ? pkgs.callPackage ./package.nix {}, # captured at eval time - nix-shell rewrites $SHELL at runtime, # so we must remember the user's real login shell here. userShell ? builtins.getEnv "SHELL", }: with pkgs; mkShell { name = "spine base dev shell"; packages = [ # ❯❯❯ spine binary built from ./package.nix spine # ❯❯❯ d_build_related ldc #dmd dub # ❯❯❯ dev gnumake git # ❯❯❯ nix_related direnv nix-direnv nix-prefetch-git nix-output-monitor nix-tree jq # ❯❯❯ sqlite search related sqlite # ❯❯❯ xml_and_epub_related # libxml2 # html-tidy # xmlstarlet # epubcheck # ebook_tools # epr # sigil # calibre #(suite includes: ebook-viewer) # koreader # foliate # ❯❯❯ pdf reader # evince # ❯❯❯ pdf_latex_related # source-sans-pro # source-serif-pro # source-code-pro # texlive.combined.scheme-full # ❯❯❯ i18n translation related # perlPackages.Po4a ]; shellHook = '' export DFLAGS="-O2 -boundscheck=on" export Date=$(date "+%Y%m%d") ## set local values in .envrc-local (or here if you must) echo "spine: $(command -v spine)" ## hand off to the user's login shell (e.g. zsh) only when this is ## an interactive nix-shell entry - not under `nix-shell --run` or ## `--command`, where exec would swallow the command. Guard env var ## prevents re-entry loops. __spine_user_shell=${if userShell == "" then "" else "\"" + userShell + "\""} if [ -z "$__SPINE_SHELL_HANDOFF" ] \ && [ -n "$__spine_user_shell" ] \ && [ "$(basename "$__spine_user_shell")" != "bash" ] \ && [[ $- == *i* ]]; then export __SPINE_SHELL_HANDOFF=1 spine --version exec "$__spine_user_shell" fi unset __spine_user_shell spine --version ''; } #+END_SRC ** package.nix :default: #+HEADER: :tangle ../package.nix #+HEADER: :tangle-mode (identity #o644) #+HEADER: :noweb yes #+BEGIN_SRC nix # package.nix - spine derivation (build logic) # # Standalone, callPackage-style derivation for the spine binary. Used by # shell.nix to put a freshly-built spine on PATH inside the dev shell. # May also be consumed via: # nix-build ./package.nix # pkgs.callPackage ./package.nix {} # # Compiler defaults to ldc/ldmd2 (matching the flake's default package # `spine-nixpkgs-ldc`). Override to build with dmd: # pkgs.callPackage ./package.nix { # compilerPkg = pkgs.dmd; # compilerBin = "dmd"; # buildType = "dmd"; # } { lib, stdenv, dub, ldc, gnumake, sqlite, compilerPkg ? ldc, compilerBin ? "ldmd2", buildType ? "ldmd2", rev ? "unknown", }: stdenv.mkDerivation { pname = "spine"; version = "<>"; src = lib.cleanSource ./.; buildInputs = [ sqlite ]; nativeBuildInputs = [ dub compilerPkg gnumake ]; preBuild = '' export HOME=$TMPDIR ''; buildPhase = '' runHook preBuild buildCMD="dub run --cache=local \ --compiler=$(type -P ${compilerBin}) \ --build=${buildType} \ --combined --skip-registry=all" echo $buildCMD $buildCMD runHook postBuild ''; checkPhase = '' runHook preCheck dub test --combined --skip-registry=all runHook postCheck ''; installPhase = '' runHook preInstall mkdir -p $out/bin install -m755 ./bin/spine $out/bin/spine runHook postInstall ''; postInstall = '' echo `ls -la $out/bin/spine` echo "❯❯ spine-v0.18.0 (rev: ${rev})" $out/bin/spine -v ''; meta = { description = "A sisu like parser & document generator"; longDescription = "a sisu like parser & document generator"; homepage = "https://sisudoc.org"; license = lib.licenses.agpl3Plus; platforms = lib.platforms.linux; mainProgram = "spine"; }; } #+END_SRC ** derivation.nix :default: #+HEADER: :tangle ../derivation.nix #+HEADER: :tangle-mode (identity #o755) #+HEADER: :shebang "#!/usr/bin/env -S nix-build derivation.nix" #+HEADER: :noweb yes #+BEGIN_SRC nix { pkgs ? import {}, stdenv ? pkgs.stdenv, lib ? pkgs.lib, ldc ? null, dcompiler ? pkgs.ldc, dub ? pkgs.dub, }: assert dcompiler != null; with ( with lib; let filterDub = name: type: let baseName = baseNameOf (toString name); in ! ( # filter function to remove the .dub package folder from src type == "directory" && baseName == ".dub" ); targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; # remove reference to build tools and library sources disallowedReferences = deps: [dcompiler dub]; removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}''; in { mkDubDerivation = lib.makeOverridable ({ src, nativeBuildInputs ? [], dubJSON ? src + "/dub.json", passthru ? {}, package ? lib.importJSON dubJSON, ... } @ attrs: stdenv.mkDerivation (attrs // { pname = package.name; nativeBuildInputs = [dcompiler dub pkgs.removeReferencesTo] ++ nativeBuildInputs; disallowedReferences = disallowedReferences deps; passthru = passthru // { inherit dub dcompiler pkgs; }; src = lib.cleanSourceWith { filter = filterDub; src = lib.cleanSource src; }; preFixup = '' find $out/bin -type f -exec ${removeExpr (disallowedReferences deps)} '{}' + || true ''; buildPhase = '' runHook preBuild 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 if [ "$DC" == "" ]; then exit "Error: could not find D compiler" fi echo "$DC_ used as D compiler to build $pname" dub run --compiler=$DC --build=release --combined --skip-registry=all runHook postBuild ''; checkPhase = '' runHook preCheck HOME="$PWD" dub test --combined --skip-registry=all runHook postCheck ''; installPhase = '' runHook preInstall mkdir -p $out/bin cp -r "${targetOf package}" $out/bin runHook postInstall ''; meta = lib.optionalAttrs (package ? description) { description = package.description; } // attrs.meta or {}; } // lib.optionalAttrs (!(attrs ? version)) { name = package.name; # use name from dub.json, unless pname and version are specified })); } ); mkDubDerivation rec { pname = "spine"; version = "<>"; src = ./.; nativeBuildInputs = with pkgs; [dub ldc]; buildInputs = with pkgs; [nixVersions.latest sqlite]; meta = with pkgs.lib; { description = "A sisu like parser & document generator"; longDescription = '' a sisu like parser & document generator ''; homepage = "https://sisudoc.org"; license = licenses.agpl3Plus; platforms = platforms.linux; maintainers = ["RalphAmissah"]; }; } #+END_SRC - unused - installPhase #+BEGIN_SRC txt installPhase = '' mkdir -p $out/bin cp spine $out/bin chmod +x $out/bin/spine ''; #+END_SRC *** nixpkgs path / url - nixpkgs_url_github - nixpkgs_url_local **** github (official) #+NAME: nixpkgs_url_github #+BEGIN_SRC shell github:NixOS/nixpkgs/nixpkgs-unstable #+END_SRC **** localhost #+NAME: nixpkgs_url_local #+BEGIN_SRC shell /srv/nix/nixpkgs #+END_SRC *** nixpkgs path options - #+NAME: nixpkgs_url #+HEADER: :noweb yes #+BEGIN_SRC org <> #+END_SRC #+NAME: nixpkgs_url_github #+BEGIN_SRC nix github:nixos/nixpkgs #+END_SRC #+NAME: nixpkgs_path_local #+BEGIN_SRC nix /srv/nix/nixpkgs #+END_SRC * misc (remove?) ** 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 ** .env/echo-nixNote CHECK MODIFY *** notes on nix commands #+HEADER: :tangle-NO ../.env/nix-commands #+BEGIN_SRC text - 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 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 #+END_SRC *** echo-nixNote #+HEADER: :tangle-NO ../.env/echo-nixNote #+BEGIN_SRC shell 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 shell 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 shell 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 shell $SpineBIN/spine --very-verbose --pod --source --output="$SpineOUTversioned" $SpinePOD/* ,#+END_SRC ,*** html & epub output ,#+BEGIN_SRC shell $SpineBIN/spine --very-verbose --html --epub --output="$SpineOUTversioned" $SpinePOD/* ,#+END_SRC ,*** sqlite db for each document - populate each db ,#+BEGIN_SRC shell $SpineBIN/spine --very-verbose --sqlite-discrete --output="$SpineOUTversioned" $SpinePOD/* ,#+END_SRC ,*** doc source; html, epub; sqlite outputs ,#+BEGIN_SRC shell $SpineBIN/spine --verbose --pod --html --epub --sqlite-discrete --output="$SpineOUTversioned" $SpinePOD/* ,#+END_SRC ,*** curate (authors topics) ,#+BEGIN_SRC shell $SpineBIN/spine --very-verbose --curate --output="$SpineOUTversioned" $SpinePOD/* ,#+END_SRC ,*** html, curate ,#+BEGIN_SRC shell $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 shell $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 shell $SpineBIN/spine --very-verbose --sqlite-db-create --output="$SpineOUTversioned" ,#+END_SRC ,*** sqlite db (shared) - populate db ,#+BEGIN_SRC shell $SpineBIN/spine --very-verbose --sqlite-update --output="$SpineOUTversioned" $SpineDOC/sisudoc-spine-markup-samples/markup/pod/* ,#+END_SRC ,*** sqlite db (shared) - drop db ,#+BEGIN_SRC shell $SpineBIN/spine --very-verbose --sqlite-db-drop --output="$SpineOUTversioned" ,#+END_SRC ,*** sqlite db (shared) - create & populate db (single step) ,#+BEGIN_SRC shell $SpineBIN/spine --very-verbose --sqlite-db-create --sqlite-update --output="$SpineOUTversioned" $SpinePOD/* ,#+END_SRC ,*** composite command: source pod, html, epub, curate, sqlite ,#+BEGIN_SRC shell $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 shell 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 shell $SpineBIN/spine --very-verbose --sqlite-db-create --output="$SpineOUT" $SpinePOD/* # CGI search form is built separately in sisudoc-spine-search-cgi/ $SpineBIN/spine -v --show-config --config=$SpinePOD/.dr $SpineBIN/spine --html $SpinePOD/* # See sisudoc-spine-search-cgi/README.md for CGI search form build instructions ,#+END_SRC ,*** generate html linked to search form ,#+BEGIN_SRC shell $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 shell $SpineBIN/spine -v --sqlite-db-create --sqlite-db-filename="<>" --sqlite-db-path="$SpineDBpath" $SpineBIN/spine -v --sqlite-db-recreate --sqlite-db-filename="<>" --sqlite-db-path="$SpineDBpath" ,#+END_SRC ,*** populate sqlite db ,#+BEGIN_SRC shell $SpineBIN/spine -v --sqlite-update --sqlite-db-filename="<>" --output=$SpineOUT $SpinePOD/* ,#+END_SRC ,*** generate html (linked to search form), sql output, curate COMPOSITE ,#+BEGIN_SRC shell $SpineBIN/spine -v --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename="<>" --cgi-sqlite-search-filename="<>" --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 shell $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: "<>" cgi_action: "https://sisudoc.org/spine_search" db_sqlite_filename: "<>" db_sqlite_path: "/var/www/sqlite" ,#+END_SRC ,*** make search form ,#+BEGIN_SRC shell # CGI search form is built separately - see sisudoc-spine-search-cgi/README.md ,#+END_SRC ,*** latex ,#+BEGIN_SRC shell $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" #+END_SRC *** db search related variables #+NAME: spine_search_db #+BEGIN_SRC shell spine.search.db #+END_SRC #+NAME: spine_search_cgi #+BEGIN_SRC shell spine_search #+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}"; \ dub run --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 * versions GET ** dlang overlays *** ldc #+NAME: ldc_version #+HEADER: :noweb yes #+BEGIN_SRC emacs-lisp <<./nix-develop-dlang-shared.org:ldc-version()>> #+END_SRC *** dmd #+NAME: dmd_version #+HEADER: :noweb yes #+BEGIN_SRC emacs-lisp <<./nix-develop-dlang-shared.org:dmd-version()>> #+END_SRC *** dub #+NAME: dub_version #+HEADER: :noweb yes #+BEGIN_SRC emacs-lisp <<./nix-develop-dlang-shared.org:dub-version()>> #+END_SRC *** dtools #+NAME: dtools_version #+HEADER: :noweb yes #+BEGIN_SRC emacs-lisp <<./nix-develop-dlang-shared.org:dtools-version()>> #+END_SRC ** sha256 blank hash #+NAME: sha256-blank #+BEGIN_SRC nix <<./nix-develop-dlang-shared.org:sha256-blank()>> #+END_SRC #+NAME: blank_hash #+BEGIN_SRC nix <<./nix-develop-dlang-shared.org:sha256-blank()>> #+END_SRC * org includes ** spine project VERSION #+NAME: spine_version #+HEADER: :noweb yes #+BEGIN_SRC emacs-lisp <<./sisudoc_spine_version_info_and_doc_header_including_copyright_and_license.org:spine_project_version()>> #+END_SRC ** year #+NAME: year #+HEADER: :noweb yes #+BEGIN_SRC emacs-lisp <<./sisudoc_spine_version_info_and_doc_header_including_copyright_and_license.org:year()>> #+END_SRC ** document header including copyright & license #+NAME: doc_header_including_copyright_and_license #+HEADER: :noweb yes #+BEGIN_SRC emacs-lisp <<./sisudoc_spine_version_info_and_doc_header_including_copyright_and_license.org:spine_doc_header_including_copyright_and_license()>> #+END_SRC * __END__