diff options
33 files changed, 747 insertions, 771 deletions
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8a834da --- /dev/null +++ b/.editorconfig @@ -0,0 +1,28 @@ +# EditorConfig : https://editorconfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +# Matches multiple files with brace expansion notation +# Set default charset +[*.{org,d,nix}] +charset = utf-8 + +# Indentation override for all D under src directory +[src/sisudoc/**.d] +indent_style = space +indent_size = 2 + +# Tab indentation (no size specified) +[Makefile] +indent_style = tab + +[{dub.selections.json,dub_describe.json}] +indent_style = space +indent_size = 2 @@ -1,8 +1,11 @@ +# -*- mode: sh -*- if [ -f .envrc-git-init ]; then source_env_if_exists .envrc-git-init || source .envrc-git-init fi if [ -f .envrc-local ]; then source_env_if_exists .envrc-local || source .envrc-local +elif [ -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 diff --git a/.envrc-git-init b/.envrc-git-init index ca74ec3..d78e46b 100644 --- a/.envrc-git-init +++ b/.envrc-git-init @@ -1,3 +1,4 @@ +# -*- mode: sh -*- if [[ ! -d ./.git ]]; then git init git add . diff --git a/.envrc-local b/.envrc-local index 392dd6e..1bafe75 100644 --- a/.envrc-local +++ b/.envrc-local @@ -1,5 +1,5 @@ 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 SpineSearchBIN=result/cgi-bin # ❯❯ cgi search form name: export SpineCGIform='spine_search' # ❯❯ configuration cgi search form path: diff --git a/.envrc-local_ b/.envrc-local_ index 392dd6e..a2671b4 100644 --- a/.envrc-local_ +++ b/.envrc-local_ @@ -1,6 +1,11 @@ +# -*- mode: sh -*- 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 SpineSearchBIN=result/cgi-bin # ❯❯ cgi search form name: export SpineCGIform='spine_search' +# ❯❯ search form db name: +export SpineSQLdb='spine.search.db' # ❯❯ configuration cgi search form path: export SpineCGIbin=/var/www/cgi/cgi-bin +# ❯❯ configuration db path: +export SpineDBpath=/var/www/sqlite @@ -1,10 +1,11 @@ +# -*- mode: nix -*- NIX_ENFORCE_PURITY=1 -# - https://github.com/nix-community/nix-direnv -NixDirEnvVersion="3.0.7" -NixDirEnvSHA="sha256-bn8WANE5a91RusFmRI7kS751ApelG02nMcwRekC/qzc=" -if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then - source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "${NixDirEnvSHA}" -fi +## - https://github.com/nix-community/nix-direnv +#NixDirEnvVersion="3.1.0" +#NixDirEnvSHA="sha256-yMJ2OVMzrFaDPn7q8nCBZFRYpL/f0RcHzhmw/i6btJM=" +#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 shell.nix @@ -24,11 +25,11 @@ echo ' • nix develop ❯❯ nix develop ".#" --print-build-logs -c zsh • nix develop using nixpkgs - ❯❯ nix develop ".#dsh-nixpkgs-dmd-dub" --print-build-logs -c zsh - ❯❯ nix develop ".#dsh-nixpkgs-ldc-dub" --print-build-logs -c zsh - • nix develop using package overlays: (dmd-2.111.0, ldc-1.41.0, dub-1.40.0) - ❯❯ nix develop ".#dsh-overlay-dmd-dub" --print-build-logs -c zsh - ❯❯ nix develop ".#dsh-overlay-ldc-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-nixpkgs-dmd" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-nixpkgs-ldc" --print-build-logs -c zsh + • nix develop using package overlays: (dmd-2.111.0, ldc-1.42.0, dub-1.40.0) + ❯❯ nix develop ".#dsh-overlay-dmd" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-overlay-ldc" --print-build-logs -c zsh ❯❯ nix flake show • to build project: @@ -40,20 +41,21 @@ echo ' • nix build using nixpkgs ❯❯ nix build ".#spine-search-nixpkgs-dmd" --print-build-logs ❯❯ nix build ".#spine-search-nixpkgs-ldc" --print-build-logs - • nix build using package overlays: (dmd-2.111.0, ldc-1.41.0, dub-1.40.0) + • nix build using package overlays: (dmd-2.111.0, ldc-1.42.0, dub-1.40.0) ❯❯ nix build ".#spine-search-overlay-dmd" --print-build-logs ❯❯ nix build ".#spine-search-overlay-ldc" --print-build-logs • to build using dub on nix (get dependencies by setting your development environment): - ❯❯ nix develop ".#dsh-nixpkgs-dmd-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-nixpkgs-dmd" --print-build-logs -c zsh ❯❯ dub run --compiler=dmd --config=dmd --combined --skip-registry=all - ❯❯ nix develop ".#dsh-nixpkgs-ldc-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-nixpkgs-ldc" --print-build-logs -c zsh ❯❯ dub run --compiler=ldmd2 --config=ldmd2 --combined --skip-registry=all • for develop environment & build options - ❯❯ nix flake show + ❯❯ nix flake update && nix flake check && nix flake show + ❯❯ nix flake show ' @@ -1,4 +1,5 @@ # git ls-files --others --exclude-from=.git/info/exclude +# git ls-files --others --ignored --exclude-standard --directory # git check-ignore -v flake.lock # git clean -ix # find . -name "*_" | xargs rm -rf @@ -6,16 +7,14 @@ * !.gitignore !.gitattributes +!.editorconfig !nix/** !*.nix !flake.lock !nixDevEnv.sh !.envrc -!.envrc-local !.envrc-nix !.envrc-git-init -!.env -!.env/** !nix-overlays !nix-overlays/** !README.md @@ -32,6 +31,8 @@ !*.org !org !org/*.org +!*.md +!*.txt !*.d !*.rb !*.txt @@ -50,16 +51,17 @@ tmp/** *_.org *_.nix *_.d +*_.md *_.txt *_ -*.swp -*~ -\#* -*.\#* !.envrc-local_ !src/sisudoc/spine_search.d_ !views/configuration.txt_remotehost_ !views/configuration.txt_localhost_ +*.swp +*~ +\#* +*.\#* #!*/ #\#* #*.\#* @@ -153,7 +153,7 @@ mkdir -p ~/.config/nix && echo "experimental-features = flakes nix-command" >> ~ - to use the D compiler ldc2: # on nix (get dependencies by setting your development environment): - nix develop ".#dsh-nixpkgs-ldc-dub" --print-build-logs -c zsh + nix develop ".#dsh-nixpkgs-ldc" --print-build-logs -c zsh # assuming you have ldc2 & dub installed on your system: dub run --compiler=ldmd2 --config=ldmd2 --combined --skip-registry=all @@ -162,7 +162,7 @@ mkdir -p ~/.config/nix && echo "experimental-features = flakes nix-command" >> ~ - to use the D compiler dmd: # on nix (get dependencies by setting your development environment): - nix develop ".#dsh-nixpkgs-dmd-dub" --print-build-logs -c zsh + nix develop ".#dsh-nixpkgs-dmd" --print-build-logs -c zsh # assuming you have dmd & dub installed on your system: dub run --compiler=dmd --config=dmd --combined --skip-registry=all @@ -136,7 +136,7 @@ mkdir -p ~/.config/nix && echo "experimental-features = flakes nix-command" >> ~ - to use the D compiler ldc2: # on nix (get dependencies by setting your development environment): - nix develop ".#dsh-nixpkgs-ldc-dub" --print-build-logs -c zsh + nix develop ".#dsh-nixpkgs-ldc" --print-build-logs -c zsh # assuming you have ldc2 & dub installed on your system: dub run --compiler=ldmd2 --config=ldmd2 --combined --skip-registry=all @@ -145,7 +145,7 @@ mkdir -p ~/.config/nix && echo "experimental-features = flakes nix-command" >> ~ - to use the D compiler dmd: # on nix (get dependencies by setting your development environment): - nix develop ".#dsh-nixpkgs-dmd-dub" --print-build-logs -c zsh + nix develop ".#dsh-nixpkgs-dmd" --print-build-logs -c zsh # assuming you have dmd & dub installed on your system: dub run --compiler=dmd --config=dmd --combined --skip-registry=all diff --git a/default.nix b/default.nix deleted file mode 100755 index 922b291..0000000 --- a/default.nix +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env -S nix-build -{pkgs ? import <nixpkgs> {}}: -pkgs.callPackage ./devenv.nix {} diff --git a/derivation.nix b/derivation.nix index efe8ebf..95797b4 100644..100755 --- a/derivation.nix +++ b/derivation.nix @@ -1,3 +1,4 @@ +#!/usr/bin/env -S nix-build derivation.nix { pkgs ? import <nixpkgs> {}, stdenv ? pkgs.stdenv, @@ -17,7 +18,7 @@ with ( ); targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; # remove reference to build tools and library sources - disallowedReferences = deps: [dcompiler dub]; + disallowedRefs = [dcompiler dub]; removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}''; in { mkDubDerivation = lib.makeOverridable ({ @@ -30,9 +31,9 @@ with ( } @ attrs: stdenv.mkDerivation (attrs // { - pname = package.name; + pname = attrs.pname or package.name; nativeBuildInputs = [dcompiler dub pkgs.removeReferencesTo] ++ nativeBuildInputs; - disallowedReferences = disallowedReferences deps; + disallowedReferences = disallowedRefs; passthru = passthru // { @@ -43,7 +44,7 @@ with ( src = lib.cleanSource src; }; preFixup = '' - find $out/share/cgi-bin -type f -exec ${removeExpr (disallowedReferences deps)} '{}' + || true + find $out/cgi-bin -type f -exec ${removeExpr disallowedRefs} '{}' + || true ''; buildPhase = '' runHook preBuild @@ -57,7 +58,8 @@ with ( fi done if [ "$DC" == "" ]; then - exit "Error: could not find D compiler" + echo "Error: could not find D compiler" >&2 + exit 1 fi echo "$DC_ used as D compiler to build $pname" dub run --compiler=$DC --build=release --combined --skip-registry=all @@ -71,14 +73,12 @@ with ( ''; installPhase = '' runHook preInstall - mkdir -p $out/share/cgi-bin - cp -r "${targetOf package}" $out/share/cgi-bin - install -m755 -D $out/share/cgi-bin/spine_search spine_search + mkdir -p $out/cgi-bin + install -m755 -D "${targetOf package}" "$out/cgi-bin/spine_search" runHook postInstall ''; postInstall = '' - echo "HERE ${targetOf package} $out/share/cgi-bin" - echo `ls -la $out/share/cgi-bin/spine_search` + echo `ls -la $out/cgi-bin/spine_search` ''; meta = lib.optionalAttrs (package ? description) { @@ -92,34 +92,32 @@ with ( } ); mkDubDerivation rec { - name = "spine-search-0.18.0"; - #name = "spine-search-${version}"; + pname = "spine-search"; + version = "0.18.0"; src = ./.; buildInputs = [ pkgs.sqlite ( - with pkgs-nix; [ + with pkgs; [ nixVersions.latest #nixVersions.latest #nixVersions.git ## package manager dub ## compiler ldc - rund + #rund sqlite ] ) ]; - meta = with pkgs-nix.lib; { - pname = "spine-search"; - version = "0.18.0"; + meta = with pkgs.lib; { homepage = "https://sisudoc.org"; description = "cgi sqlite search form for document object search"; longDescription = '' a sisu like parser & document generator ''; - homepage = "https://sisudoc.org"; license = licenses.agpl3Plus; platforms = platforms.linux; maintainers = ["RalphAmissah"]; + mainProgram = "spine_search"; }; } diff --git a/devenv.nix b/devenv.nix deleted file mode 100644 index 60a373e..0000000 --- a/devenv.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ - pkgs ? import <nixpkgs> {}, - name ? "user-env", -}: -with pkgs; - buildEnv { - inherit name; - extraOutputsToInstall = ["out" "man" "lib"]; # to get all needed symlinks - paths = [ - # ❯❯❯ nix_related - #nix # if not on NixOS, this is needed - direnv - nixVersions.latest #nixVersions.latest #nixVersions.git - nix-prefetch-git - validatePkgConfig - nix-output-monitor - nix-tree - jq #gx - #nixfmt-rfc-style - git - # ❯❯❯ dev - gnumake - ps - # ❯❯❯ d_build_related - # ❯❯ package manager - dub - # ❯❯ compiler - #dmd - ldc - # ❯❯❯ sqlite search related - sqlite - # this will create a script that will rebuild and upgrade your setup; using shell script syntax - (writeScriptBin "nix-rebuild" '' - #!${stdenv.shell} - #cd <path-to-flake> || exit 1 - nix flake update - nix profile upgrade '.*' - '') - # puts in your root the nixpkgs version - (writeTextFile { - name = "nixpkgs-version"; - destination = "/nixpkgs-version"; - text = lib.version; - }) - ]; - } @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1772674223, - "narHash": "sha256-/suKbHSaSmuC9UY7G0VRQ3aO+QKqxAQPQ19wG7QNkF8=", + "lastModified": 1777826146, + "narHash": "sha256-wQ/iN5Zp5VIa3ebBibijPnLyKhor+xEbDy4d0goa9Zs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "66d9241e3dc2296726dc522e62dbfe89c7b449f3", + "rev": "73c703c22422b8951895a960959dbbaca7296492", "type": "github" }, "original": { @@ -29,11 +29,11 @@ ] }, "locked": { - "lastModified": 1772401501, - "narHash": "sha256-7cKJSsl+lXSeqwDemc8KYPGOjpvvHArOktHPFE0UzhM=", + "lastModified": 1775877366, + "narHash": "sha256-W33lhJ9+/KEl1xoGKw/BYHIZpuqjLpDHjlue2CVQrcM=", "ref": "refs/heads/main", - "rev": "28b68997e1e337d0d20de38e953107c48fb079be", - "revCount": 27, + "rev": "40ccbcf2cf53b1fd1476e7ced6b70c29d491d464", + "revCount": 30, "type": "git", "url": "git://git.sisudoc.org/package/dlang-nix-overlays-and-flake" }, @@ -1,35 +1,28 @@ { description = "a sisu like document parser search form"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - #inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.spine-d-overlay = { url = "git://git.sisudoc.org/package/dlang-nix-overlays-and-flake"; inputs.nixpkgs.follows = "nixpkgs"; - flake = true; }; outputs = { self, nixpkgs, - #flake-utils, spine-d-overlay, ... }@inputs: let pname = "spine_search"; version = "0.18.0"; - shell = ./shell.nix; - devEnv = ./nixDevEnv.sh; + #shell = ./shell.nix; + #devEnv = ./nixDevEnv.sh; supportedSystems = ["x86_64-linux"]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); # nixpkgs instantiated for supported system types - checkPhase = '' - runHook preCheck - dub test --combined --skip-registry=all - runHook postCheck - ''; localOverlay = (final: prev: { - ldc = prev.callPackage ./nix-overlays/ldc { }; - dmd = prev.callPackage ./nix-overlays/dmd { }; - dub = prev.callPackage ./nix-overlays/dub { }; + ldc = prev.callPackage ./nix-overlays/ldc { }; # -> ok 1.42.0 + # 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 2.111.0 + dub = prev.callPackage ./nix-overlays/dub { }; # -> ? 1.40.0 #gdc = prev.callPackage ./nix-overlays/gdc { }; }); pkgsForSystem = system: import nixpkgs { @@ -41,165 +34,79 @@ preBuild = '' export HOME=$(pwd) ''; + 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 + mkdir -p $out/cgi-bin + install -m755 -D ./cgi-bin/spine_search $out/cgi-bin/spine_search runHook postInstall ''; postInstall = '' - echo `ls -la $out/share/cgi-bin/spine_search` + echo `ls -la $out/cgi-bin/spine_search` ''; + # Helper to reduce duplication across build variants + mkSpineSearch = {pkgs, compiler, compilerCmd, dubConfig}: pkgs.stdenv.mkDerivation { + inherit pname version; + meta.mainProgram = "spine_search"; + src = self; + buildInputs = [pkgs.sqlite]; + nativeBuildInputs = [pkgs.dub compiler pkgs.gnumake]; + buildPhase = '' + runHook preBuild + buildCMD="dub run --cache=local --compiler=$(type -P ${compilerCmd}) --build=${dubConfig} --combined --skip-registry=all" + echo $buildCMD + $buildCMD + echo $buildCMD + runHook postBuild + ''; + inherit preBuild; + inherit checkPhase; + inherit installPhase; + inherit postInstall; + }; in { packages = forAllSystems (system: let pkgs-ovl = pkgsForSystem system; pkgs-nix = nixpkgsFor.${system}; - in - with pkgs-nix; { - default = stdenv.mkDerivation { - inherit pname; - inherit version; - meta.mainProgram = "spine-search"; - executable = true; - src = self; - inherit shell; - inherit devEnv; - buildInputs = [sqlite]; - nativeBuildInputs = [dub ldc gnumake]; - buildPhase = '' - runHook preBuild - 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" - buildCMD="dub run --cache=local --compiler=$DC --build=$DC_ --combined --skip-registry=all" - echo $buildCMD - $buildCMD - echo $buildCMD - runHook postBuild - ''; - inherit preBuild; - inherit checkPhase; - inherit installPhase; - inherit postInstall; - }; - spine-search-nixpkgs-dmd = stdenv.mkDerivation { - inherit pname; - inherit version; - meta.mainProgram = "spine_search-dmd"; - executable = true; - src = self; - inherit shell; - inherit devEnv; - buildInputs = with pkgs-nix; [sqlite]; - nativeBuildInputs = with pkgs-nix; [dub dmd gnumake]; - buildPhase = '' - runHook preBuild - buildCMD="dub run --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all" - echo $buildCMD - $buildCMD - echo $buildCMD - runHook postBuild - ''; - inherit preBuild; - inherit checkPhase; - inherit installPhase; - inherit postInstall; - }; - spine-search-nixpkgs-ldc = stdenv.mkDerivation { - inherit pname; - inherit version; - meta.mainProgram = "spine_search-ldc"; - executable = true; - src = self; - inherit shell; - inherit devEnv; - buildInputs = with pkgs-nix; [sqlite]; - nativeBuildInputs = with pkgs-nix; [dub ldc gnumake]; - buildPhase = '' - runHook preBuild - buildCMD="dub run --cache=local --compiler=$(type -P ldmd2) --build=ldmd2 --combined --skip-registry=all" - echo $buildCMD - $buildCMD - echo $buildCMD - runHook postBuild - ''; - inherit preBuild; - inherit checkPhase; - inherit installPhase; - inherit postInstall; - }; - spine-search-overlay-dmd = stdenv.mkDerivation { - inherit pname; - inherit version; - meta.mainProgram = "spine_search-dmd"; - executable = true; - src = self; - inherit shell; - inherit devEnv; - buildInputs = with pkgs-ovl; [sqlite]; - nativeBuildInputs = with pkgs-ovl; [dub dmd gnumake]; - buildPhase = '' - runHook preBuild - buildCMD="dub run --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all" - echo $buildCMD - $buildCMD - echo $buildCMD - runHook postBuild - ''; - inherit preBuild; - inherit checkPhase; - inherit installPhase; - inherit postInstall; - }; - spine-search-overlay-ldc = stdenv.mkDerivation { - inherit pname; - inherit version; - meta.mainProgram = "spine_search-ldc"; - executable = true; - src = self; - inherit shell; - inherit devEnv; - buildInputs = with pkgs-ovl; [sqlite]; - nativeBuildInputs = with pkgs-ovl; [dub ldc gnumake]; - buildPhase = '' - runHook preBuild - buildCMD="dub run --cache=local --compiler=$(type -P ldmd2) --build=ldmd2 --combined --skip-registry=all" - echo $buildCMD - $buildCMD - echo $buildCMD - runHook postBuild - ''; - inherit preBuild; - inherit checkPhase; - inherit installPhase; - inherit postInstall; - }; - #spine-search-overlay-gdc = stdenv.mkDerivation { - # inherit pname; - # inherit version; - # meta.mainProgram = "spine_search-gdc"; - # executable = true; - # src = self; - # inherit shell; - # inherit devEnv; - # buildInputs = with pkgs-ovl; [ sqlite ]; - # nativeBuildInputs = with pkgs-ovl; [ dub gdc gnumake ]; - # buildPhase = '' - # runHook preBuild - # dub run --cache=local --compiler=$(type -P gdc) --build=gdc --combined --skip-registry=all - # runHook postBuild - # ''; - # inherit preBuild; - # inherit checkPhase; - # inherit installPhase; - # inherit postInstall; - #}; - #vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000="; - }); + in { + default = self.packages.${system}.spine-search-nixpkgs-ldc; + spine-search-nixpkgs-dmd = mkSpineSearch { + pkgs = pkgs-nix; + # 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; + compilerCmd = "dmd"; + dubConfig = "dmd"; + }; + spine-search-nixpkgs-ldc = mkSpineSearch { + pkgs = pkgs-nix; + compiler = pkgs-nix.ldc; + compilerCmd = "ldmd2"; + dubConfig = "ldmd2"; + }; + spine-search-overlay-dmd = mkSpineSearch { + pkgs = pkgs-ovl; + compiler = pkgs-ovl.dmd; + compilerCmd = "dmd"; + dubConfig = "dmd"; + }; + spine-search-overlay-ldc = mkSpineSearch { + pkgs = pkgs-ovl; + compiler = pkgs-ovl.ldc; + compilerCmd = "ldmd2"; + dubConfig = "ldmd2"; + }; + #spine-search-overlay-gdc = mkSpineSearch { + # pkgs = pkgs-ovl; + # compiler = pkgs-ovl.gdc; + # compilerCmd = "gdc"; + # dubConfig = "gdc"; + #}; + }); devShells = forAllSystems (system: let pkgs-ovl = pkgsForSystem system; pkgs-nix = nixpkgsFor.${system}; @@ -211,9 +118,7 @@ with pkgs-nix; { dsh-d-overlay = spine-d-overlay.devShells.${system}.default; dsh-overlay = mkShell { - name = "spine-0.18.0 base dev shell, ldc-1.41.0, dub-1.40.0"; - inherit shell; - inherit devEnv; + name = "${pname}-${version} dev shell (overlay)"; packages = with pkgs-ovl; [ ldc #dmd @@ -223,10 +128,8 @@ ]; inherit shellHook; }; - dsh-nixpkgs-dmd-dub = mkShell { - name = "spine-0.18.0 base dev shell"; - inherit shell; - inherit devEnv; + dsh-nixpkgs-dmd = mkShell { + name = "${pname}-${version} dev shell (nixpkgs dmd)"; packages = [ dmd dub @@ -235,10 +138,8 @@ ]; inherit shellHook; }; - dsh-nixpkgs-ldc-dub = mkShell { - name = "spine-0.18.0 base dev shell"; - inherit shell; - inherit devEnv; + dsh-nixpkgs-ldc = mkShell { + name = "${pname}-${version} dev shell (nixpkgs ldc)"; packages = [ ldc dub @@ -247,10 +148,9 @@ ]; inherit shellHook; }; - dsh-overlay-dmd-dub = mkShell { - name = "spine-0.18.0 base dev shell, dmd-2.111.0, dub-1.40.0"; - inherit shell; - inherit devEnv; + dsh-overlay-dmd = mkShell { + name = "${pname}-${version} dev shell (overlay dmd)"; + # "spine-0.18.0 base dev shell, dmd-2.111.0, dub-1.40.0"; packages = with pkgs-ovl; [ dmd dub @@ -259,10 +159,9 @@ ]; inherit shellHook; }; - dsh-overlay-ldc-dub = mkShell { - name = "spine-0.18.0 base dev shell, ldc-1.41.0, dub-1.40.0"; - inherit shell; - inherit devEnv; + dsh-overlay-ldc = mkShell { + name = "${pname}-${version} dev shell (overlay ldc)"; + # "spine-0.18.0 base dev shell, ldc-1.42.0, dub-1.40.0"; packages = with pkgs-ovl; [ ldc dub @@ -272,9 +171,7 @@ inherit shellHook; }; dsh-sqlite = mkShell { - name = "spine dev shell for latex & pdf output"; - inherit shell; - inherit devEnv; + name = "${pname}-${version} dev shell (sqlite)"; packages = [ ldc #dmd @@ -284,7 +181,8 @@ ]; inherit shellHook; }; - default = import ./shell.nix {inherit pkgs-nix;}; + default = self.devShells.${system}.dsh-nixpkgs-ldc; + #default = import ./shell.nix {pkgs = pkgs-nix;}; }); }; } @@ -83,7 +83,7 @@ set_depends: get_depends # cp cgi search form cp-cgi: sudo cp -vi /var/www/cgi/cgi-bin/spine_search /var/www/cgi/cgi-bin/spine_search_old && \ - sudo cp -vi result/share/cgi-bin/spine_search /var/www/cgi/cgi-bin/spine_search + sudo cp -vi result/cgi-bin/spine_search /var/www/cgi/cgi-bin/spine_search # git archive gitZip: diff --git a/nix-overlays/dtools/disabled-tests.diff b/nix-overlays/dtools/disabled-tests.diff index a22825a..79eb1cb 100644 --- a/nix-overlays/dtools/disabled-tests.diff +++ b/nix-overlays/dtools/disabled-tests.diff @@ -3,7 +3,7 @@ @@ -616,7 +616,7 @@ void runTests(string rdmdApp, string compiler, string model) enforce(res.status == 1, res.output); } - + - version (Posix) + version (none) { diff --git a/nix-overlays/dtools/fix-ldc-arm64.diff b/nix-overlays/dtools/fix-ldc-arm64.diff index 66eaa22..1c650a6 100644 --- a/nix-overlays/dtools/fix-ldc-arm64.diff +++ b/nix-overlays/dtools/fix-ldc-arm64.diff @@ -82,21 +82,21 @@ Adapted from https://github.com/dlang/tools/commit/6c6a042d1b08e3ec1790bd07a7f69 @@ -9,9 +9,8 @@ DUB=dub WITH_DOC = no DOC = ../dlang.org - + -# Load operating system $(OS) (e.g. linux, osx, ...) and $(MODEL) (e.g. 32, 64) detection Makefile from dmd -$(shell [ ! -d $(DMD_DIR) ] && git clone --depth=1 https://github.com/dlang/dmd $(DMD_DIR)) -include $(DMD_DIR)/compiler/src/osmodel.mak +# Load operating system $(OS) (e.g. linux, osx, ...) and $(MODEL) (e.g. 32, 64) detection Makefile +include osmodel.mak - + ifeq (windows,$(OS)) DOTEXE:=.exe @@ -30,7 +29,7 @@ DFLAGS = $(MODEL_FLAG) $(if $(findstring windows,$(OS)),,-fPIC) -preview=dip1000 DFLAGS += $(WARNINGS) - + # Default DUB flags (DUB uses a different architecture format) -DUBFLAGS = --arch=$(subst 32,x86,$(subst 64,x86_64,$(MODEL))) +DUBFLAGS = --arch=$(ARCH) - + TOOLS = \ $(ROOT)/catdoc$(DOTEXE) \ diff --git a/nix-overlays/ldc/package.nix b/nix-overlays/ldc/package.nix index 75eb898..b5daa75 100644 --- a/nix-overlays/ldc/package.nix +++ b/nix-overlays/ldc/package.nix @@ -138,6 +138,8 @@ stdenv.mkDerivation (finalAttrs: { find $out/bin -type f -exec ${removeReferencesTo}/bin/remove-references-to -t ${ldcBootstrap} '{}' + ''; + # doCheck = false; + disallowedReferences = [ ldcBootstrap ]; meta = with lib; { @@ -181,6 +183,6 @@ stdenv.mkDerivation (finalAttrs: { no-references-to-compiler = helloWorld.overrideAttrs { disallowedReferences = [ ldc ]; dFlags = ["-g"]; + }; }; - }; }) diff --git a/org/config_d_cfte.org b/org/config_d_cfte.org index f866acc..ef471f8 100644 --- a/org/config_d_cfte.org +++ b/org/config_d_cfte.org @@ -7,13 +7,13 @@ #+COPYRIGHT: Copyright (C) 2015 (continuously updated, current 2026) Ralph Amissah #+LANGUAGE: en #+STARTUP: content 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+ :eval never-export :exports code +#+PROPERTY: header-args+ :noweb yes :padline no +#+PROPERTY: header-args+ :results silent :cache no #+PROPERTY: header-args+ :mkdirp yes #+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t +- magic single double-quote → " ← FIX changes hilighting behavior (occuring + after it) in org document. INVESTIGATE (org-mode CONFIG?) FIND & FIX - [[./doc-reform.org][doc-reform.org]] [[../org/][org/]] diff --git a/org/config_dub.org b/org/config_dub.org index 6d022f1..6d91118 100644 --- a/org/config_dub.org +++ b/org/config_dub.org @@ -7,13 +7,13 @@ #+COPYRIGHT: Copyright (C) 2015 (continuously updated, current 2026) Ralph Amissah #+LANGUAGE: en #+STARTUP: content 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+ :eval never-export :exports code +#+PROPERTY: header-args+ :noweb yes :padline no +#+PROPERTY: header-args+ :results silent :cache no #+PROPERTY: header-args+ :mkdirp yes #+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t +- magic single double-quote → " ← FIX changes hilighting behavior (occuring + after it) in org document. INVESTIGATE (org-mode CONFIG?) FIND & FIX - [[./doc-reform.org][doc-reform.org]] [[./][org/]] diff --git a/org/config_env.org b/org/config_env.org index 8bc8c55..42d99bc 100644 --- a/org/config_env.org +++ b/org/config_env.org @@ -7,13 +7,13 @@ #+COPYRIGHT: Copyright (C) 2015 (continuously updated, current 2026) Ralph Amissah #+LANGUAGE: en #+STARTUP: content 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+ :eval never-export :exports code +#+PROPERTY: header-args+ :noweb yes :padline no +#+PROPERTY: header-args+ :results silent :cache no #+PROPERTY: header-args+ :mkdirp yes #+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t +- magic single double-quote → " ← FIX changes hilighting behavior (occuring + after it) in org document. INVESTIGATE (org-mode CONFIG?) FIND & FIX - [[./doc-reform.org][doc-reform.org]] [[../org/][org/]] - [[./config_nix.org][config_nix.org]] @@ -33,12 +33,16 @@ fi #+NAME: envrc #+HEADER: :tangle ../.envrc +#+HEADER: :tangle-mode (identity #o644) +#+HEADER: :shebang "# -*- mode: sh -*-" #+BEGIN_SRC shell if [ -f .envrc-git-init ]; then source_env_if_exists .envrc-git-init || source .envrc-git-init fi if [ -f .envrc-local ]; then source_env_if_exists .envrc-local || source .envrc-local +elif [ -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 @@ -53,14 +57,16 @@ fi - ${NixDirEnvVersion} #+HEADER: :tangle ../.envrc-nix +#+HEADER: :tangle-mode (identity #o644) +#+HEADER: :shebang "# -*- mode: nix -*-" #+BEGIN_SRC shell NIX_ENFORCE_PURITY=1 -# - https://github.com/nix-community/nix-direnv -NixDirEnvVersion="<<direnv_version>>" -NixDirEnvSHA="<<direnv_hash>>" -if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then - source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "${NixDirEnvSHA}" -fi +## - https://github.com/nix-community/nix-direnv +#NixDirEnvVersion="<<direnv_version>>" +#NixDirEnvSHA="<<direnv_hash>>" +#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 shell.nix @@ -80,11 +86,11 @@ echo ' • nix develop ❯❯ nix develop ".#" --print-build-logs -c zsh • nix develop using nixpkgs - ❯❯ nix develop ".#dsh-nixpkgs-dmd-dub" --print-build-logs -c zsh - ❯❯ nix develop ".#dsh-nixpkgs-ldc-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-nixpkgs-dmd" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-nixpkgs-ldc" --print-build-logs -c zsh • nix develop using package overlays: (dmd-<<dmd_version>>, ldc-<<ldc_version>>, dub-<<dub_version>>) - ❯❯ nix develop ".#dsh-overlay-dmd-dub" --print-build-logs -c zsh - ❯❯ nix develop ".#dsh-overlay-ldc-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-overlay-dmd" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-overlay-ldc" --print-build-logs -c zsh ❯❯ nix flake show • to build project: @@ -102,15 +108,16 @@ echo ' • to build using dub on nix (get dependencies by setting your development environment): - ❯❯ nix develop ".#dsh-nixpkgs-dmd-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-nixpkgs-dmd" --print-build-logs -c zsh ❯❯ dub run --compiler=dmd --config=dmd --combined --skip-registry=all - ❯❯ nix develop ".#dsh-nixpkgs-ldc-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-nixpkgs-ldc" --print-build-logs -c zsh ❯❯ dub run --compiler=ldmd2 --config=ldmd2 --combined --skip-registry=all • for develop environment & build options - ❯❯ nix flake show + ❯❯ nix flake update && nix flake check && nix flake show + ❯❯ nix flake show ' #+END_SRC @@ -118,6 +125,8 @@ echo ' ** .envrc-git-init #+HEADER: :tangle ../.envrc-git-init +#+HEADER: :tangle-mode (identity #o644) +#+HEADER: :shebang "# -*- mode: sh -*-" #+HEADER: :noweb yes #+BEGIN_SRC shell if [[ ! -d ./.git ]]; then @@ -130,18 +139,58 @@ fi - bespoke modify appropriately and generate if needed -#+HEADER: :tangle ../.envrc-local +#+HEADER: :tangle ../.envrc-local_ +#+HEADER: :tangle-mode (identity #o644) +#+HEADER: :shebang "# -*- mode: sh -*-" #+HEADER: :noweb yes #+BEGIN_SRC shell 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 SpineSearchBIN=result/cgi-bin # ❯❯ cgi search form name: export SpineCGIform='spine_search' +# ❯❯ search form db name: +export SpineSQLdb='spine.search.db' # ❯❯ configuration cgi search form path: export SpineCGIbin=/var/www/cgi/cgi-bin +# ❯❯ configuration db path: +export SpineDBpath=/var/www/sqlite #+END_SRC -* versions GET +* editorconfig + +#+HEADER: :tangle "../.editorconfig" +#+BEGIN_SRC gitignore +# EditorConfig : https://editorconfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +# Matches multiple files with brace expansion notation +# Set default charset +[*.{org,d,nix}] +charset = utf-8 + +# Indentation override for all D under src directory +[src/sisudoc/**.d] +indent_style = space +indent_size = 2 + +# Tab indentation (no size specified) +[Makefile] +indent_style = tab + +[{dub.selections.json,dub_describe.json}] +indent_style = space +indent_size = 2 +#+END_SRC + +* org includes - versions GET ** direnv #+NAME: direnv_version @@ -156,14 +205,6 @@ export SpineCGIbin=/var/www/cgi/cgi-bin <<./nix-develop-dlang-shared.org:direnv-hash()>> #+END_SRC -** spine project VERSION :version:set:project: - -#+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 - ** dlang overlays *** ldc @@ -197,4 +238,26 @@ export SpineCGIbin=/var/www/cgi/cgi-bin <<./nix-develop-dlang-shared.org:dtools-version()>> #+END_SRC +** spine project VERSION :version:set:project: + +#+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 + +#+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__ diff --git a/org/config_git.org b/org/config_git.org index 014155e..0c82c4e 100644 --- a/org/config_git.org +++ b/org/config_git.org @@ -7,20 +7,21 @@ #+COPYRIGHT: Copyright (C) 2015 (continuously updated, current 2026) Ralph Amissah #+LANGUAGE: en #+STARTUP: content 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+ :eval never-export :exports code +#+PROPERTY: header-args+ :noweb yes :padline no +#+PROPERTY: header-args+ :results silent :cache no #+PROPERTY: header-args+ :mkdirp yes #+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t +- magic single double-quote → " ← FIX changes hilighting behavior (occuring + after it) in org document. INVESTIGATE (org-mode CONFIG?) FIND & FIX -* spine +* git config spine search ** .gitignore :gitignore: #+HEADER: :tangle "../.gitignore" #+BEGIN_SRC gitignore # git ls-files --others --exclude-from=.git/info/exclude +# git ls-files --others --ignored --exclude-standard --directory # git check-ignore -v flake.lock # git clean -ix # find . -name "*_" | xargs rm -rf @@ -28,16 +29,14 @@ ,* !.gitignore !.gitattributes +!.editorconfig !nix/** !*.nix !flake.lock !nixDevEnv.sh !.envrc -!.envrc-local !.envrc-nix !.envrc-git-init -!.env -!.env/** !nix-overlays !nix-overlays/** !README.md @@ -54,6 +53,8 @@ !*.org !org !org/*.org +!*.md +!*.txt !*.d !*.rb !*.txt @@ -72,16 +73,17 @@ tmp/** ,*_.org ,*_.nix ,*_.d +,*_.md ,*_.txt ,*_ -,*.swp -,*~ -\#* -,*.\#* !.envrc-local_ !src/sisudoc/spine_search.d_ !views/configuration.txt_remotehost_ !views/configuration.txt_localhost_ +,*.swp +,*~ +\#* +,*.\#* #!*/ #\#* #*.\#* diff --git a/org/config_make.org b/org/config_make.org index 235276f..f4a290f 100644 --- a/org/config_make.org +++ b/org/config_make.org @@ -7,12 +7,13 @@ #+COPYRIGHT: Copyright (C) 2015 (continuously updated, current 2026) Ralph Amissah #+LANGUAGE: en #+STARTUP: content 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+ :eval never-export :exports code +#+PROPERTY: header-args+ :noweb yes :padline no +#+PROPERTY: header-args+ :results silent :cache no #+PROPERTY: header-args+ :mkdirp yes +#+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t +- magic single double-quote → " ← FIX changes hilighting behavior (occuring + after it) in org document. INVESTIGATE (org-mode CONFIG?) FIND & FIX - [[./doc-reform.org][doc-reform.org]] [[../org/][org/]] @@ -134,7 +135,7 @@ set_depends: get_depends # cp cgi search form cp-cgi: sudo cp -vi /var/www/cgi/cgi-bin/spine_search /var/www/cgi/cgi-bin/spine_search_old && \ - sudo cp -vi result/share/cgi-bin/spine_search /var/www/cgi/cgi-bin/spine_search + sudo cp -vi result/cgi-bin/spine_search /var/www/cgi/cgi-bin/spine_search # git archive gitZip: diff --git a/org/config_nix.org b/org/config_nix.org index b371dab..365757e 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -6,14 +6,14 @@ #+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 +#+STARTUP: content hideblocks hidestars noindent entitiespretty +#+PROPERTY: header-args+ :eval never-export :exports code +#+PROPERTY: header-args+ :noweb yes :padline no +#+PROPERTY: header-args+ :results silent :cache no #+PROPERTY: header-args+ :mkdirp yes #+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t +- magic single double-quote → " ← FIX changes hilighting behavior (occuring + after it) in org document. INVESTIGATE (org-mode CONFIG?) FIND & FIX * nix :nix: ** flake.nix :flake: @@ -24,35 +24,28 @@ { description = "a sisu like document parser search form"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - #inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.spine-d-overlay = { url = "<<sisudoc_dlang_nix_overlay_src>>"; inputs.nixpkgs.follows = "nixpkgs"; - flake = true; }; outputs = { self, nixpkgs, - #flake-utils, spine-d-overlay, ... }@inputs: let pname = "spine_search"; version = "<<spine_version>>"; - shell = ./shell.nix; - devEnv = ./nixDevEnv.sh; + #shell = ./shell.nix; + #devEnv = ./nixDevEnv.sh; supportedSystems = ["x86_64-linux"]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); # nixpkgs instantiated for supported system types - checkPhase = '' - runHook preCheck - dub test --combined --skip-registry=all - runHook postCheck - ''; localOverlay = (final: prev: { - ldc = prev.callPackage ./nix-overlays/ldc { }; - dmd = prev.callPackage ./nix-overlays/dmd { }; - dub = prev.callPackage ./nix-overlays/dub { }; + ldc = prev.callPackage ./nix-overlays/ldc { }; # -> ok <<ldc_version>> + # 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 <<dmd_version>> + dub = prev.callPackage ./nix-overlays/dub { }; # -> ? <<dub_version>> #gdc = prev.callPackage ./nix-overlays/gdc { }; }); pkgsForSystem = system: import nixpkgs { @@ -64,165 +57,79 @@ preBuild = '' export HOME=$(pwd) ''; + 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 + mkdir -p $out/cgi-bin + install -m755 -D ./cgi-bin/spine_search $out/cgi-bin/spine_search runHook postInstall ''; postInstall = '' - echo `ls -la $out/share/cgi-bin/spine_search` + echo `ls -la $out/cgi-bin/spine_search` ''; + # Helper to reduce duplication across build variants + mkSpineSearch = {pkgs, compiler, compilerCmd, dubConfig}: pkgs.stdenv.mkDerivation { + inherit pname version; + meta.mainProgram = "spine_search"; + src = self; + buildInputs = [pkgs.sqlite]; + nativeBuildInputs = [pkgs.dub compiler pkgs.gnumake]; + buildPhase = '' + runHook preBuild + buildCMD="dub run --cache=local --compiler=$(type -P ${compilerCmd}) --build=${dubConfig} --combined --skip-registry=all" + echo $buildCMD + $buildCMD + echo $buildCMD + runHook postBuild + ''; + inherit preBuild; + inherit checkPhase; + inherit installPhase; + inherit postInstall; + }; in { packages = forAllSystems (system: let pkgs-ovl = pkgsForSystem system; pkgs-nix = nixpkgsFor.${system}; - in - with pkgs-nix; { - default = stdenv.mkDerivation { - inherit pname; - inherit version; - meta.mainProgram = "spine-search"; - executable = true; - src = self; - inherit shell; - inherit devEnv; - buildInputs = [sqlite]; - nativeBuildInputs = [dub ldc gnumake]; - buildPhase = '' - runHook preBuild - 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" - buildCMD="dub run --cache=local --compiler=$DC --build=$DC_ --combined --skip-registry=all" - echo $buildCMD - $buildCMD - echo $buildCMD - runHook postBuild - ''; - inherit preBuild; - inherit checkPhase; - inherit installPhase; - inherit postInstall; - }; - spine-search-nixpkgs-dmd = stdenv.mkDerivation { - inherit pname; - inherit version; - meta.mainProgram = "spine_search-dmd"; - executable = true; - src = self; - inherit shell; - inherit devEnv; - buildInputs = with pkgs-nix; [sqlite]; - nativeBuildInputs = with pkgs-nix; [dub dmd gnumake]; - buildPhase = '' - runHook preBuild - buildCMD="dub run --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all" - echo $buildCMD - $buildCMD - echo $buildCMD - runHook postBuild - ''; - inherit preBuild; - inherit checkPhase; - inherit installPhase; - inherit postInstall; - }; - spine-search-nixpkgs-ldc = stdenv.mkDerivation { - inherit pname; - inherit version; - meta.mainProgram = "spine_search-ldc"; - executable = true; - src = self; - inherit shell; - inherit devEnv; - buildInputs = with pkgs-nix; [sqlite]; - nativeBuildInputs = with pkgs-nix; [dub ldc gnumake]; - buildPhase = '' - runHook preBuild - buildCMD="dub run --cache=local --compiler=$(type -P ldmd2) --build=ldmd2 --combined --skip-registry=all" - echo $buildCMD - $buildCMD - echo $buildCMD - runHook postBuild - ''; - inherit preBuild; - inherit checkPhase; - inherit installPhase; - inherit postInstall; - }; - spine-search-overlay-dmd = stdenv.mkDerivation { - inherit pname; - inherit version; - meta.mainProgram = "spine_search-dmd"; - executable = true; - src = self; - inherit shell; - inherit devEnv; - buildInputs = with pkgs-ovl; [sqlite]; - nativeBuildInputs = with pkgs-ovl; [dub dmd gnumake]; - buildPhase = '' - runHook preBuild - buildCMD="dub run --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all" - echo $buildCMD - $buildCMD - echo $buildCMD - runHook postBuild - ''; - inherit preBuild; - inherit checkPhase; - inherit installPhase; - inherit postInstall; - }; - spine-search-overlay-ldc = stdenv.mkDerivation { - inherit pname; - inherit version; - meta.mainProgram = "spine_search-ldc"; - executable = true; - src = self; - inherit shell; - inherit devEnv; - buildInputs = with pkgs-ovl; [sqlite]; - nativeBuildInputs = with pkgs-ovl; [dub ldc gnumake]; - buildPhase = '' - runHook preBuild - buildCMD="dub run --cache=local --compiler=$(type -P ldmd2) --build=ldmd2 --combined --skip-registry=all" - echo $buildCMD - $buildCMD - echo $buildCMD - runHook postBuild - ''; - inherit preBuild; - inherit checkPhase; - inherit installPhase; - inherit postInstall; - }; - #spine-search-overlay-gdc = stdenv.mkDerivation { - # inherit pname; - # inherit version; - # meta.mainProgram = "spine_search-gdc"; - # executable = true; - # src = self; - # inherit shell; - # inherit devEnv; - # buildInputs = with pkgs-ovl; [ sqlite ]; - # nativeBuildInputs = with pkgs-ovl; [ dub gdc gnumake ]; - # buildPhase = '' - # runHook preBuild - # dub run --cache=local --compiler=$(type -P gdc) --build=gdc --combined --skip-registry=all - # runHook postBuild - # ''; - # inherit preBuild; - # inherit checkPhase; - # inherit installPhase; - # inherit postInstall; - #}; - #vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000="; - }); + in { + default = self.packages.${system}.spine-search-nixpkgs-ldc; + spine-search-nixpkgs-dmd = mkSpineSearch { + pkgs = pkgs-nix; + # 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; + compilerCmd = "dmd"; + dubConfig = "dmd"; + }; + spine-search-nixpkgs-ldc = mkSpineSearch { + pkgs = pkgs-nix; + compiler = pkgs-nix.ldc; + compilerCmd = "ldmd2"; + dubConfig = "ldmd2"; + }; + spine-search-overlay-dmd = mkSpineSearch { + pkgs = pkgs-ovl; + compiler = pkgs-ovl.dmd; + compilerCmd = "dmd"; + dubConfig = "dmd"; + }; + spine-search-overlay-ldc = mkSpineSearch { + pkgs = pkgs-ovl; + compiler = pkgs-ovl.ldc; + compilerCmd = "ldmd2"; + dubConfig = "ldmd2"; + }; + #spine-search-overlay-gdc = mkSpineSearch { + # pkgs = pkgs-ovl; + # compiler = pkgs-ovl.gdc; + # compilerCmd = "gdc"; + # dubConfig = "gdc"; + #}; + }); devShells = forAllSystems (system: let pkgs-ovl = pkgsForSystem system; pkgs-nix = nixpkgsFor.${system}; @@ -234,9 +141,7 @@ with pkgs-nix; { dsh-d-overlay = spine-d-overlay.devShells.${system}.default; dsh-overlay = mkShell { - name = "spine-<<spine_version>> base dev shell, ldc-<<ldc_version>>, dub-<<dub_version>>"; - inherit shell; - inherit devEnv; + name = "${pname}-${version} dev shell (overlay)"; packages = with pkgs-ovl; [ ldc #dmd @@ -246,10 +151,8 @@ ]; inherit shellHook; }; - dsh-nixpkgs-dmd-dub = mkShell { - name = "spine-<<spine_version>> base dev shell"; - inherit shell; - inherit devEnv; + dsh-nixpkgs-dmd = mkShell { + name = "${pname}-${version} dev shell (nixpkgs dmd)"; packages = [ dmd dub @@ -258,10 +161,8 @@ ]; inherit shellHook; }; - dsh-nixpkgs-ldc-dub = mkShell { - name = "spine-<<spine_version>> base dev shell"; - inherit shell; - inherit devEnv; + dsh-nixpkgs-ldc = mkShell { + name = "${pname}-${version} dev shell (nixpkgs ldc)"; packages = [ ldc dub @@ -270,10 +171,9 @@ ]; inherit shellHook; }; - dsh-overlay-dmd-dub = mkShell { - name = "spine-<<spine_version>> base dev shell, dmd-<<dmd_version>>, dub-<<dub_version>>"; - inherit shell; - inherit devEnv; + dsh-overlay-dmd = mkShell { + name = "${pname}-${version} dev shell (overlay dmd)"; + # "spine-<<spine_version>> base dev shell, dmd-<<dmd_version>>, dub-<<dub_version>>"; packages = with pkgs-ovl; [ dmd dub @@ -282,10 +182,9 @@ ]; inherit shellHook; }; - dsh-overlay-ldc-dub = mkShell { - name = "spine-<<spine_version>> base dev shell, ldc-<<ldc_version>>, dub-<<dub_version>>"; - inherit shell; - inherit devEnv; + dsh-overlay-ldc = mkShell { + name = "${pname}-${version} dev shell (overlay ldc)"; + # "spine-<<spine_version>> base dev shell, ldc-<<ldc_version>>, dub-<<dub_version>>"; packages = with pkgs-ovl; [ ldc dub @@ -295,9 +194,7 @@ inherit shellHook; }; dsh-sqlite = mkShell { - name = "spine dev shell for latex & pdf output"; - inherit shell; - inherit devEnv; + name = "${pname}-${version} dev shell (sqlite)"; packages = [ ldc #dmd @@ -307,7 +204,8 @@ ]; inherit shellHook; }; - default = import ./shell.nix {inherit pkgs-nix;}; + default = self.devShells.${system}.dsh-nixpkgs-ldc; + #default = import ./shell.nix {pkgs = pkgs-nix;}; }); }; } @@ -316,10 +214,75 @@ ** 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 +#!/usr/bin/env -S nix-shell --pure +#!nix-shell -i bash +# Development environment for sisudoc-spine-search-cgi. +# Builds the spine_search CGI binary via ./package.nix. +# +# Build logic for the spine_search derivation lives in ./package.nix - +# this file only describes the dev shell. +# +# Usage: +# nix-shell # enters shell, builds spine_search +# nix-shell --run 'echo $SPINE_SEARCH_BIN' +{ + pkgs ? import <nixpkgs> {}, + spine-search ? 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_search base dev shell"; + packages = [ + # ❯❯❯ spine_search CGI binary built from ./package.nix + spine-search + # ❯❯❯ d_build_related + ldc + #dmd + dub + # ❯❯❯ dev + gnumake + git + # ❯❯❯ nix workflow + direnv + nix-direnv + nix-prefetch-git + nix-output-monitor + nix-tree + jq + # ❯❯❯ sqlite + sqlite + ]; + shellHook = '' + export Date=$(date "+%Y%m%d") + ## set local values in .envrc-local (or here if you must) + ## spine_search lives under cgi-bin, not bin - expose it via env + ## var and prepend cgi-bin to PATH for convenience. + export SPINE_SEARCH_BIN="${spine-search}/cgi-bin/spine_search" + export PATH="${spine-search}/cgi-bin:$PATH" + echo "spine_search: $SPINE_SEARCH_BIN" + ## 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_SEARCH_SHELL_HANDOFF" ] \ + && [ -n "$__spine_user_shell" ] \ + && [ "$(basename "$__spine_user_shell")" != "bash" ] \ + && [[ $- == *i* ]]; then + export __SPINE_SEARCH_SHELL_HANDOFF=1 + exec "$__spine_user_shell" + fi + unset __spine_user_shell + ''; + } +#+END_SRC + +#+BEGIN_SRC nix {pkgs-nix ? import <nixpkgs> {}}: with pkgs-nix; mkShell { @@ -327,6 +290,7 @@ with pkgs-nix; # ❯❯❯ nix_related #nix direnv + nix-direnv nixVersions.latest #nixVersions.latest #nixVersions.git nix-prefetch-git validatePkgConfig @@ -363,80 +327,90 @@ with pkgs-nix; echo "ldc `${pkgs.ldc}/bin/ldc2 -v`" -** default.nix :default: - -#+HEADER: :tangle ../default.nix -#+HEADER: :tangle-mode (identity #o755) -#+HEADER: :shebang "#!/usr/bin/env -S nix-build" -#+BEGIN_SRC nix -{pkgs ? import <nixpkgs> {}}: -pkgs.callPackage ./devenv.nix {} -#+END_SRC - -#+HEADER: :tangle-mode (identity #o755) -#+HEADER: :shebang "#!/usr/bin/env -S nix-build" -#+BEGIN_SRC nix -{ pkgs ? import <nixpkgs> {} }: -pkgs.callPackage ./derivation.nix {} -#+END_SRC - -*** devenv.nix :default:devenv: +** package.nix :default: -#+HEADER: :tangle ../devenv.nix +#+HEADER: :tangle ../package.nix #+HEADER: :tangle-mode (identity #o644) +#+HEADER: :noweb yes #+BEGIN_SRC nix +# package.nix - spine_search CGI derivation (build logic) +# +# Standalone, callPackage-style derivation for the spine_search CGI +# binary. Used by shell.nix to put a freshly-built spine_search into +# 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-search-nixpkgs-ldc`). Override to build with dmd: +# pkgs.callPackage ./package.nix { +# compilerPkg = pkgs.dmd; +# compilerBin = "dmd"; +# buildType = "dmd"; +# } +# +# Note: spine_search is a CGI binary and is installed to +# $out/cgi-bin/spine_search (not $out/bin/), since it is intended to +# be served by a web server, not invoked directly from PATH. { - pkgs ? import <nixpkgs> {}, - name ? "user-env", + lib, + stdenv, + dub, + ldc, + gnumake, + sqlite, + compilerPkg ? ldc, + compilerBin ? "ldmd2", + buildType ? "ldmd2", }: -with pkgs; - buildEnv { - inherit name; - extraOutputsToInstall = ["out" "man" "lib"]; # to get all needed symlinks - paths = [ - # ❯❯❯ nix_related - #nix # if not on NixOS, this is needed - direnv - nixVersions.latest #nixVersions.latest #nixVersions.git - nix-prefetch-git - validatePkgConfig - nix-output-monitor - nix-tree - jq #gx - #nixfmt-rfc-style - git - # ❯❯❯ dev - gnumake - ps - # ❯❯❯ d_build_related - # ❯❯ package manager - dub - # ❯❯ compiler - #dmd - ldc - # ❯❯❯ sqlite search related - sqlite - # this will create a script that will rebuild and upgrade your setup; using shell script syntax - (writeScriptBin "nix-rebuild" '' - #!${stdenv.shell} - #cd <path-to-flake> || exit 1 - nix flake update - nix profile upgrade '.*' - '') - # puts in your root the nixpkgs version - (writeTextFile { - name = "nixpkgs-version"; - destination = "/nixpkgs-version"; - text = lib.version; - }) - ]; - } +stdenv.mkDerivation { + pname = "spine_search"; + version = "0.18.0"; + src = lib.cleanSource ./.; + buildInputs = [ sqlite ]; + nativeBuildInputs = [ dub compilerPkg gnumake ]; + preBuild = '' + export HOME=$(pwd) + ''; + 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/cgi-bin + install -m755 -D ./cgi-bin/spine_search $out/cgi-bin/spine_search + runHook postInstall + ''; + postInstall = '' + echo `ls -la $out/cgi-bin/spine_search` + ''; + meta = { + description = "CGI search interface for spine document collections"; + homepage = "https://sisudoc.org"; + license = lib.licenses.agpl3Plus; + platforms = lib.platforms.linux; + mainProgram = "spine_search"; + }; +} #+END_SRC ** derivation.nix :default: #+HEADER: :tangle ../derivation.nix -#+HEADER: :tangle-mode (identity #o644) +#+HEADER: :tangle-mode (identity #o755) +#+HEADER: :shebang "#!/usr/bin/env -S nix-build derivation.nix" #+HEADER: :noweb yes #+BEGIN_SRC nix { @@ -458,7 +432,7 @@ with ( ); targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; # remove reference to build tools and library sources - disallowedReferences = deps: [dcompiler dub]; + disallowedRefs = [dcompiler dub]; removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}''; in { mkDubDerivation = lib.makeOverridable ({ @@ -471,9 +445,9 @@ with ( } @ attrs: stdenv.mkDerivation (attrs // { - pname = package.name; + pname = attrs.pname or package.name; nativeBuildInputs = [dcompiler dub pkgs.removeReferencesTo] ++ nativeBuildInputs; - disallowedReferences = disallowedReferences deps; + disallowedReferences = disallowedRefs; passthru = passthru // { @@ -484,7 +458,7 @@ with ( src = lib.cleanSource src; }; preFixup = '' - find $out/share/cgi-bin -type f -exec ${removeExpr (disallowedReferences deps)} '{}' + || true + find $out/cgi-bin -type f -exec ${removeExpr disallowedRefs} '{}' + || true ''; buildPhase = '' runHook preBuild @@ -498,7 +472,8 @@ with ( fi done if [ "$DC" == "" ]; then - exit "Error: could not find D compiler" + echo "Error: could not find D compiler" >&2 + exit 1 fi echo "$DC_ used as D compiler to build $pname" dub run --compiler=$DC --build=release --combined --skip-registry=all @@ -512,14 +487,12 @@ with ( ''; installPhase = '' runHook preInstall - mkdir -p $out/share/cgi-bin - cp -r "${targetOf package}" $out/share/cgi-bin - install -m755 -D $out/share/cgi-bin/spine_search spine_search + mkdir -p $out/cgi-bin + install -m755 -D "${targetOf package}" "$out/cgi-bin/spine_search" runHook postInstall ''; postInstall = '' - echo "HERE ${targetOf package} $out/share/cgi-bin" - echo `ls -la $out/share/cgi-bin/spine_search` + echo `ls -la $out/cgi-bin/spine_search` ''; meta = lib.optionalAttrs (package ? description) { @@ -533,35 +506,33 @@ with ( } ); mkDubDerivation rec { - name = "spine-search-<<spine_version>>"; - #name = "spine-search-${version}"; + pname = "spine-search"; + version = "<<spine_version>>"; src = ./.; buildInputs = [ pkgs.sqlite ( - with pkgs-nix; [ + with pkgs; [ nixVersions.latest #nixVersions.latest #nixVersions.git ## package manager dub ## compiler ldc - rund + #rund sqlite ] ) ]; - meta = with pkgs-nix.lib; { - pname = "spine-search"; - version = "<<spine_version>>"; + meta = with pkgs.lib; { homepage = "https://sisudoc.org"; description = "cgi sqlite search form for document object search"; longDescription = '' a sisu like parser & document generator ''; - homepage = "https://sisudoc.org"; license = licenses.agpl3Plus; platforms = platforms.linux; maintainers = ["RalphAmissah"]; + mainProgram = "spine_search"; }; } #+END_SRC diff --git a/org/nix-develop-dlang-shared.org b/org/nix-develop-dlang-shared.org index fec2815..e971677 100644 --- a/org/nix-develop-dlang-shared.org +++ b/org/nix-develop-dlang-shared.org @@ -7,13 +7,13 @@ #+COPYRIGHT: Copyright (C) 2015 (continuously updated, current 2026) Ralph Amissah #+LANGUAGE: en #+STARTUP: content hideblocks hidestars noindent entitiespretty -#+PROPERTY: header-args :noweb yes -#+PROPERTY: header-args+ :exports code -#+PROPERTY: header-args+ :results silent -#+PROPERTY: header-args+ :cache no -#+PROPERTY: header-args+ :padline no +#+PROPERTY: header-args+ :eval never-export :exports code +#+PROPERTY: header-args+ :noweb yes :padline no +#+PROPERTY: header-args+ :results silent :cache no #+PROPERTY: header-args+ :mkdirp yes #+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t +- magic single double-quote → " ← FIX changes hilighting behavior (occuring + after it) in org document. INVESTIGATE (org-mode CONFIG?) FIND & FIX * nix ** direnv @@ -27,6 +27,7 @@ check for latest version: update direnv version and sha hash: - emacs org/nix-develop-dlang-shared.org +- direnv fetchurl https://raw.githubusercontent.com/nix-community/nix-direnv/3.1.0/direnvrc re-tangle file: @@ -40,74 +41,26 @@ update flake.lock: #+NAME: direnv-version #+BEGIN_SRC org -<<direnv_version_3_0_7>> +<<direnv_version_3_1_0>> #+END_SRC #+NAME: direnv-hash #+BEGIN_SRC org -<<direnv_hash_3_0_7>> +<<direnv_hash_3_1_0>> #+END_SRC *** versions -**** 3.0.7 +**** 3.1.0 -#+NAME: direnv_version_3_0_7 +#+NAME: direnv_version_3_1_0 #+BEGIN_SRC org -3.0.7 +3.1.0 #+END_SRC -#+NAME: direnv_hash_3_0_7 +#+NAME: direnv_hash_3_1_0 #+BEGIN_SRC org -sha256-bn8WANE5a91RusFmRI7kS751ApelG02nMcwRekC/qzc= -#+END_SRC - -**** 3.0.6 - -#+NAME: direnv_version_3_0_6 -#+BEGIN_SRC org -3.0.6 -#+END_SRC - -#+NAME: direnv_hash_3_0_6 -#+BEGIN_SRC org -sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM= -#+END_SRC - -**** 3.0.4 - -#+NAME: direnv_version_3_0_4 -#+BEGIN_SRC org -3.0.4 -#+END_SRC - -#+NAME: direnv_hash_3_0_4 -#+BEGIN_SRC org -sha256-DzlYZ33mWF/Gs8DDeyjr8mnVmQGx7ASYqA5WlxwvBG4= -#+END_SRC - -**** 3.0.0 - -#+NAME: direnv_version_3_0_0 -#+BEGIN_SRC org -3.0.0 -#+END_SRC - -#+NAME: direnv_hash_3_0_0 -#+BEGIN_SRC org -sha256-21TMnI2xWX7HkSTjFFri2UaohXVj854mgvWapWrxRXg= -#+END_SRC - -**** 2.4.0 - -#+NAME: direnv_version_2_4_0 -#+BEGIN_SRC org -2.4.0 -#+END_SRC - -#+NAME: direnv_hash_2_4_0 -#+BEGIN_SRC org -sha256-XQzUAvL6pysIJnRJyR7uVpmUSZfc7LSgWQwq/4mBr1U= +sha256-yMJ2OVMzrFaDPn7q8nCBZFRYpL/f0RcHzhmw/i6btJM= #+END_SRC * dlang diff --git a/org/nixpkgs_overlays_d_related.org b/org/nixpkgs_overlays_d_related.org index 17fd309..727e136 100644 --- a/org/nixpkgs_overlays_d_related.org +++ b/org/nixpkgs_overlays_d_related.org @@ -7,14 +7,14 @@ #+COPYRIGHT: Copyright (C) 2020 Ralph Amissah #+LICENSE: Boost Software License 1.0 #+LANGUAGE: en -#+STARTUP: show3levels 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 +#+STARTUP: content hideblocks hidestars noindent entitiespretty +#+PROPERTY: header-args+ :eval never-export :exports code +#+PROPERTY: header-args+ :noweb yes :padline no +#+PROPERTY: header-args+ :results silent :cache no #+PROPERTY: header-args+ :mkdirp yes #+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:nil _:nil -:t f:t *:t <:t +- magic single double-quote → " ← FIX changes hilighting behavior (occuring + after it) in org document. INVESTIGATE (org-mode CONFIG?) FIND & FIX * nix ( written to ./dlang-nix-flakes/ ) ** check updates CHECK @@ -351,7 +351,7 @@ use flake . ]; inherit shellHook; }; - dsh-overlay-ldc-dub = mkShell { + dsh-overlay-ldc = mkShell { name = "overlay - ldc-<<ldc_version>> - dub-<<dub_version>> - dtools-<<dtools_version>>"; inherit shell; inherit devEnv; @@ -363,7 +363,7 @@ use flake . ]; inherit shellHook; }; - dsh-overlay-dmd-dub = mkShell { + dsh-overlay-dmd = mkShell { name = "overlay - dmd-<<dmd_version>> - dub-<<dub_version>> - dtools-<<dtools_version>>"; inherit shell; inherit devEnv; @@ -401,7 +401,7 @@ use flake . # ]; # inherit shellHook; #}; - dsh-nixpkgs-ldc-dub = mkShell { + dsh-nixpkgs-ldc = mkShell { name = "nixpkgs - ldc - dub"; inherit shell; inherit devEnv; @@ -413,7 +413,7 @@ use flake . ]; inherit shellHook; }; - dsh-nixpkgs-dmd-dub = mkShell { + dsh-nixpkgs-dmd = mkShell { name = "nixpkgs - ldc - dub"; inherit shell; inherit devEnv; @@ -649,6 +649,8 @@ stdenv.mkDerivation (finalAttrs: { find $out/bin -type f -exec ${removeReferencesTo}/bin/remove-references-to -t ${ldcBootstrap} '{}' + ''; + # doCheck = false; + disallowedReferences = [ ldcBootstrap ]; meta = with lib; { @@ -692,8 +694,8 @@ stdenv.mkDerivation (finalAttrs: { no-references-to-compiler = helloWorld.overrideAttrs { disallowedReferences = [ ldc ]; dFlags = ["-g"]; + }; }; - }; }) #+END_SRC @@ -1399,7 +1401,7 @@ stdenv.mkDerivation (finalAttrs: { @@ -616,7 +616,7 @@ void runTests(string rdmdApp, string compiler, string model) enforce(res.status == 1, res.output); } - + - version (Posix) + version (none) { @@ -1493,22 +1495,22 @@ Adapted from https://github.com/dlang/tools/commit/6c6a042d1b08e3ec1790bd07a7f69 @@ -9,9 +9,8 @@ DUB=dub WITH_DOC = no DOC = ../dlang.org - + -# Load operating system $(OS) (e.g. linux, osx, ...) and $(MODEL) (e.g. 32, 64) detection Makefile from dmd -$(shell [ ! -d $(DMD_DIR) ] && git clone --depth=1 https://github.com/dlang/dmd $(DMD_DIR)) -include $(DMD_DIR)/compiler/src/osmodel.mak +# Load operating system $(OS) (e.g. linux, osx, ...) and $(MODEL) (e.g. 32, 64) detection Makefile +include osmodel.mak - + ifeq (windows,$(OS)) DOTEXE:=.exe @@ -30,7 +29,7 @@ DFLAGS = $(MODEL_FLAG) $(if $(findstring windows,$(OS)),,-fPIC) -preview=dip1000 DFLAGS += $(WARNINGS) - + # Default DUB flags (DUB uses a different architecture format) -DUBFLAGS = --arch=$(subst 32,x86,$(subst 64,x86_64,$(MODEL))) +DUBFLAGS = --arch=$(ARCH) - + TOOLS = \ $(ROOT)/catdoc$(DOTEXE) \ #+END_SRC diff --git a/org/sisudoc_spine_version_info_and_doc_header_including_copyright_and_license.org b/org/sisudoc_spine_version_info_and_doc_header_including_copyright_and_license.org index a4e8254..b2a6fec 100644 --- a/org/sisudoc_spine_version_info_and_doc_header_including_copyright_and_license.org +++ b/org/sisudoc_spine_version_info_and_doc_header_including_copyright_and_license.org @@ -7,13 +7,13 @@ #+COPYRIGHT: Copyright (C) 2015 (continuously updated, current 2026) Ralph Amissah #+LANGUAGE: en #+STARTUP: content hideblocks hidestars noindent entitiespretty -#+PROPERTY: header-args :noweb yes -#+PROPERTY: header-args+ :exports code -#+PROPERTY: header-args+ :results silent -#+PROPERTY: header-args+ :cache no -#+PROPERTY: header-args+ :padline no +#+PROPERTY: header-args+ :eval never-export :exports code +#+PROPERTY: header-args+ :noweb yes :padline no +#+PROPERTY: header-args+ :results silent :cache no #+PROPERTY: header-args+ :mkdirp yes #+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t +- magic single double-quote → " ← FIX changes hilighting behavior (occuring + after it) in org document. INVESTIGATE (org-mode CONFIG?) FIND & FIX - [[./doc-reform.org][doc-reform.org]] [[./][org/]] diff --git a/org/spine_info.org b/org/spine_info.org index d4c200e..fbff7bb 100644 --- a/org/spine_info.org +++ b/org/spine_info.org @@ -7,13 +7,13 @@ #+COPYRIGHT: Copyright (C) 2015 (continuously updated, current 2026) Ralph Amissah #+LANGUAGE: en #+STARTUP: content 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+ :eval never-export :exports code +#+PROPERTY: header-args+ :noweb yes :padline no +#+PROPERTY: header-args+ :results silent :cache no #+PROPERTY: header-args+ :mkdirp yes #+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t +- magic single double-quote → " ← FIX changes hilighting behavior (occuring + after it) in org document. INVESTIGATE (org-mode CONFIG?) FIND & FIX - [[./doc-reform.org][doc-reform.org]] [[./][org/]] - [[./spine_build_scaffold.org][spine_build_scaffold.org]] @@ -269,7 +269,7 @@ mkdir -p ~/.config/nix && echo "experimental-features = flakes nix-command" >> ~ #+BEGIN_SRC text - to use the D compiler ldc2: # on nix (get dependencies by setting your development environment): - nix develop ".#dsh-nixpkgs-ldc-dub" --print-build-logs -c zsh + nix develop ".#dsh-nixpkgs-ldc" --print-build-logs -c zsh # assuming you have ldc2 & dub installed on your system: dub run --compiler=ldmd2 --config=ldmd2 --combined --skip-registry=all @@ -278,7 +278,7 @@ mkdir -p ~/.config/nix && echo "experimental-features = flakes nix-command" >> ~ - to use the D compiler dmd: # on nix (get dependencies by setting your development environment): - nix develop ".#dsh-nixpkgs-dmd-dub" --print-build-logs -c zsh + nix develop ".#dsh-nixpkgs-dmd" --print-build-logs -c zsh # assuming you have dmd & dub installed on your system: dub run --compiler=dmd --config=dmd --combined --skip-registry=all @@ -325,7 +325,7 @@ web-server is configured to find it. ** notices *** project (project root) ./ -#+HEADER: :tangle "../COPYRIGHT" +#+HEADER: :tangle-NO "../COPYRIGHT" #+HEADER: :noweb yes #+BEGIN_SRC text - Name: spine - SiSU Spine, Doc Reform @@ -342,7 +342,7 @@ web-server is configured to find it. *** code source ./src -#+HEADER: :tangle "../src/COPYRIGHT" +#+HEADER: :tangle-NO "../src/COPYRIGHT" #+HEADER: :noweb yes #+BEGIN_SRC text - Name: spine - SiSU Spine, Doc Reform @@ -359,7 +359,7 @@ web-server is configured to find it. *** code source ./src/sisudoc -#+HEADER: :tangle "../src/sisudoc/COPYRIGHT" +#+HEADER: :tangle-NO "../src/sisudoc/COPYRIGHT" #+HEADER: :noweb yes #+BEGIN_SRC text - Name: spine - SiSU Spine, Doc Reform @@ -382,7 +382,7 @@ web-server is configured to find it. - license - dependency information -#+HEADER: :tangle "../org/COPYRIGHT" +#+HEADER: :tangle-NO "../org/COPYRIGHT" #+HEADER: :noweb yes #+BEGIN_SRC text - Name: spine - SiSU Spine, Doc Reform diff --git a/org/spine_search_cgi.org b/org/spine_search_cgi.org index 74b1df7..b298da2 100644 --- a/org/spine_search_cgi.org +++ b/org/spine_search_cgi.org @@ -7,13 +7,13 @@ #+COPYRIGHT: Copyright (C) 2015 (continuously updated, current 2026) Ralph Amissah #+LANGUAGE: en #+STARTUP: content 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+ :eval never-export :exports code +#+PROPERTY: header-args+ :noweb yes :padline no +#+PROPERTY: header-args+ :results silent :cache no #+PROPERTY: header-args+ :mkdirp yes #+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t +- magic single double-quote → " ← FIX changes hilighting behavior (occuring + after it) in org document. INVESTIGATE (org-mode CONFIG?) FIND & FIX - [[./doc-reform.org][doc-reform.org]] [[./][org/]] - [[./spine_build_scaffold.org][make/build]] VERSION diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..bbe23ca --- /dev/null +++ b/package.nix @@ -0,0 +1,71 @@ +# package.nix - spine_search CGI derivation (build logic) +# +# Standalone, callPackage-style derivation for the spine_search CGI +# binary. Used by shell.nix to put a freshly-built spine_search into +# 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-search-nixpkgs-ldc`). Override to build with dmd: +# pkgs.callPackage ./package.nix { +# compilerPkg = pkgs.dmd; +# compilerBin = "dmd"; +# buildType = "dmd"; +# } +# +# Note: spine_search is a CGI binary and is installed to +# $out/cgi-bin/spine_search (not $out/bin/), since it is intended to +# be served by a web server, not invoked directly from PATH. +{ + lib, + stdenv, + dub, + ldc, + gnumake, + sqlite, + compilerPkg ? ldc, + compilerBin ? "ldmd2", + buildType ? "ldmd2", +}: +stdenv.mkDerivation { + pname = "spine_search"; + version = "0.18.0"; + src = lib.cleanSource ./.; + buildInputs = [ sqlite ]; + nativeBuildInputs = [ dub compilerPkg gnumake ]; + preBuild = '' + export HOME=$(pwd) + ''; + 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/cgi-bin + install -m755 -D ./cgi-bin/spine_search $out/cgi-bin/spine_search + runHook postInstall + ''; + postInstall = '' + echo `ls -la $out/cgi-bin/spine_search` + ''; + meta = { + description = "CGI search interface for spine document collections"; + homepage = "https://sisudoc.org"; + license = lib.licenses.agpl3Plus; + platforms = lib.platforms.linux; + mainProgram = "spine_search"; + }; +} @@ -1,41 +1,64 @@ #!/usr/bin/env -S nix-shell --pure #!nix-shell -i bash -{pkgs-nix ? import <nixpkgs> {}}: -with pkgs-nix; +# Development environment for sisudoc-spine-search-cgi. +# Builds the spine_search CGI binary via ./package.nix. +# +# Build logic for the spine_search derivation lives in ./package.nix - +# this file only describes the dev shell. +# +# Usage: +# nix-shell # enters shell, builds spine_search +# nix-shell --run 'echo $SPINE_SEARCH_BIN' +{ + pkgs ? import <nixpkgs> {}, + spine-search ? 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 { - buildInputs = [ - # ❯❯❯ nix_related - #nix + name = "spine_search base dev shell"; + packages = [ + # ❯❯❯ spine_search CGI binary built from ./package.nix + spine-search + # ❯❯❯ d_build_related + ldc + #dmd + dub + # ❯❯❯ dev + gnumake + git + # ❯❯❯ nix workflow direnv - nixVersions.latest #nixVersions.latest #nixVersions.git + nix-direnv nix-prefetch-git - validatePkgConfig nix-output-monitor nix-tree - jq #gx - #nixfmt-rfc-style - git - # ❯❯❯ dev - gnumake - ps - # ❯❯❯ d_build_related - # ❯❯ package manager - #dub - # ❯❯ compiler - #dmd - #ldc - #rund - # ❯❯ linker - #lld - #mold - # ❯❯ builder - #ninja - #meson - # ❯❯❯ sqlite search related + jq + # ❯❯❯ sqlite sqlite - # ❯❯❯ tools - #aria #wget #curl ]; shellHook = '' + export Date=$(date "+%Y%m%d") + ## set local values in .envrc-local (or here if you must) + ## spine_search lives under cgi-bin, not bin - expose it via env + ## var and prepend cgi-bin to PATH for convenience. + export SPINE_SEARCH_BIN="${spine-search}/cgi-bin/spine_search" + export PATH="${spine-search}/cgi-bin:$PATH" + echo "spine_search: $SPINE_SEARCH_BIN" + ## 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_SEARCH_SHELL_HANDOFF" ] \ + && [ -n "$__spine_user_shell" ] \ + && [ "$(basename "$__spine_user_shell")" != "bash" ] \ + && [[ $- == *i* ]]; then + export __SPINE_SEARCH_SHELL_HANDOFF=1 + exec "$__spine_user_shell" + fi + unset __spine_user_shell ''; } diff --git a/src/COPYRIGHT b/src/COPYRIGHT index 6b510e1..6d7ee50 100644 --- a/src/COPYRIGHT +++ b/src/COPYRIGHT @@ -1,33 +1,33 @@ - Name: spine - SiSU Spine, Doc Reform - Description: documents, structuring, processing, publishing, search - static content generator - + - Author: Ralph Amissah [ralph.amissah@gmail.com] - + - Copyright: (C) 2015 - 2026 Ralph Amissah - code under src/* src/sisudoc/* - License: AGPL 3 or later: - + Spine, Doc Reform (SiSU), a framework for document structuring, publishing and search - + Copyright (C) Ralph Amissah - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU AFERO General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see [https://www.gnu.org/licenses/]. - + If you have Internet connection, the latest version of the AGPL should be available at these locations: [https://www.fsf.org/licensing/licenses/agpl.html] @@ -39,7 +39,7 @@ modifications - docReform object numbering (based on SiSU object citation numbering) - standard SiSU document object numbering - + - Homepages: [https://www.sisudoc.org] diff --git a/src/sisudoc/COPYRIGHT b/src/sisudoc/COPYRIGHT index 6b510e1..6d7ee50 100644 --- a/src/sisudoc/COPYRIGHT +++ b/src/sisudoc/COPYRIGHT @@ -1,33 +1,33 @@ - Name: spine - SiSU Spine, Doc Reform - Description: documents, structuring, processing, publishing, search - static content generator - + - Author: Ralph Amissah [ralph.amissah@gmail.com] - + - Copyright: (C) 2015 - 2026 Ralph Amissah - code under src/* src/sisudoc/* - License: AGPL 3 or later: - + Spine, Doc Reform (SiSU), a framework for document structuring, publishing and search - + Copyright (C) Ralph Amissah - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU AFERO General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see [https://www.gnu.org/licenses/]. - + If you have Internet connection, the latest version of the AGPL should be available at these locations: [https://www.fsf.org/licensing/licenses/agpl.html] @@ -39,7 +39,7 @@ modifications - docReform object numbering (based on SiSU object citation numbering) - standard SiSU document object numbering - + - Homepages: [https://www.sisudoc.org] |
