diff options
-rw-r--r-- | .envrc | 5 | ||||
-rw-r--r-- | .envrc-local_ | 16 | ||||
-rw-r--r-- | .gitignore | 6 | ||||
-rwxr-xr-x | default.nix | 2 | ||||
-rw-r--r-- | derivation.nix | 2 | ||||
-rw-r--r-- | devenv.nix | 63 | ||||
-rw-r--r-- | dub.json | 43 | ||||
-rw-r--r-- | flake.lock | 11 | ||||
-rw-r--r-- | flake.nix | 161 | ||||
-rw-r--r-- | makefile | 16 | ||||
-rw-r--r-- | org/config_dub.org | 43 | ||||
-rw-r--r-- | org/config_git.org | 18 | ||||
-rw-r--r-- | org/config_make.org | 10 | ||||
-rw-r--r-- | org/config_nix.org | 1279 | ||||
-rwxr-xr-x | shell.nix | 6 | ||||
-rw-r--r-- | test.nix | 10 |
16 files changed, 1060 insertions, 631 deletions
@@ -1,10 +1,11 @@ +# nix_direnv_watch_file provided-filename use flake . NIX_ENFORCE_PURITY=1 -NixDirEnvVersion="2.1.2" +NixDirEnvVersion="2.2.0" if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then # - https://github.com/nix-community/nix-direnv # source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-0000000000000000000000000000000000000000000=" - source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-ytpQmMcUBR2czh8kGOqn/dmD6u55m3lDbeu/G8HGD7A=" + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-5EwyKnkJNQeXrRkYbwwRBcXbibosCJqyIUuz9Xq+LRc=" fi if [ -f .envrc-local ]; then source_env_if_exists .envrc-local || source .envrc-local diff --git a/.envrc-local_ b/.envrc-local_ index 1c0fa63..2a660d4 100644 --- a/.envrc-local_ +++ b/.envrc-local_ @@ -1,18 +1,19 @@ -echo ".envrc called .envrc-local" +# reload when these files change +watch_file flake.lock +watch_file flake.nix +nix flake update; nix flake check; nix flake show +#use flake .#default PATH_add result/bin export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos -#export NIX_PATH=nixpkgs=/nixpkgs/nixpkgs -#export NIX_PATH=/nixpkgs/nixpkgs +#export NIX_PATH=/srv/nix/nixpkgs +#export NIX_PATH=nixpkgs=/srv/nix/nixpkgs export DFLAGS="-O2 -inline -boundscheck=on -color=on" -# reload when these files change -# watch_file flake.nix -# watch_file flake.lock ## load the flake devShell # eval "$(nix print-dev-env)" # echo $NIX_BUILD_TOP export Date=`date "+%Y%m%d"` export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g') -export SpinePROJ=~/grotto/repo/git.repo/projects/project-spine/doc-reform +export SpinePROJ=~/grotto/repo/git.repo/projects/doc-reform/code/software/spine export SpineSRC=$SpinePROJ/src export SpineBIN=$SpinePROJ/result/bin export SpineDOC=~/grotto/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples @@ -27,4 +28,3 @@ export SpineCGIform='spine_search' export SpineSQLdb='spine.search.db' export PROG_VER_GIT="`git describe --long --tags | sed -e 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g'`" export PROG_VER_DECLARED="`cat ./views/version.txt | grep --color=never "enum" | sed 's/.\+(\([0-9]\+\),[ \t]\+\([0-9]\+\),[ \t]\+\([0-9]\+\)[ \t]*).\+/\1.\2.\3/g'`" -#direnv allow @@ -6,11 +6,9 @@ * !.gitignore !.gitattributes -!*.nix -!nix !nix/** !*.nix -#!flake.lock +!flake.lock !.envrc !README.md !README @@ -29,7 +27,6 @@ !*.d !*.rb !*.txt -!conf.sdl !doc !doc/** !man @@ -69,6 +66,7 @@ notes/** **/cgi-bin/** tmp/** *_.org +*_.nix *_.d *_.txt *_ diff --git a/default.nix b/default.nix index 72f4f02..f00ab4c 100755 --- a/default.nix +++ b/default.nix @@ -1,3 +1,3 @@ #!/usr/bin/env -S nix-build { pkgs ? import <nixpkgs> {} }: -pkgs.callPackage ./derivation.nix {} +pkgs.callPackage ./devenv.nix {} diff --git a/derivation.nix b/derivation.nix index 4f1c1c4..da3c183 100644 --- a/derivation.nix +++ b/derivation.nix @@ -85,7 +85,7 @@ mkDubDerivation rec { meta = with pkgs.lib; { description = "A sisu like parser and document generator"; longDescription = '' - A sisu like parser and document generator + a sisu like parser and document generator ''; homepage = "https://sisudoc.org"; license = licenses.agpl3Plus; diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 0000000..81eff5a --- /dev/null +++ b/devenv.nix @@ -0,0 +1,63 @@ +# profile.nix +{ pkgs ? import <nixpkgs> { }, name ? "user-env" }: with pkgs; +buildEnv { + inherit name; + extraOutputsToInstall = [ "out" "man" "lib" ]; # to get all needed symlinks + paths = [ + #nix # if not on NixOS, this is needed + direnv + nixVersions.unstable #nixFlakes + nix-prefetch-git + validatePkgConfig + nix-tree jq nix-output-monitor + git + ps + ### d_build_related + dub + ## compiler + dmd + ldc + #gdc + #rund + ## linker + #lld + #mold + ## builder + #ninja + #meson + ### sqlite search related + sqlite + # ### pdf_latex_related + # source-sans-pro + # source-serif-pro + # source-code-pro + # texlive.combined.scheme-full + # ### xml_and_epub_related + # libxml2 + # html-tidy + # xmlstarlet + # epubcheck + # ebook_tools + # epr + # sigil + # calibre #(suite includes: ebook-viewer) + # foliate + # ### i18n translation related + # perl534Packages.Po4a + ### candy + #starship + # 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; + }) + ]; +} @@ -17,12 +17,27 @@ "buildTypes": { "dmd": { "dflags": [ "-J=views", "-I=src/doc_reform" ], - "buildOptions": [ "verbose", "inline" ], + "buildOptions": [ "inline", "verbose" ], "buildRequirements": [ "allowWarnings" ] }, - "ldc": { + "ldc2": { "dflags": [ "-O2", "-J=views", "-I=src/doc_reform" ], - "buildOptions": [ "verbose", "optimize", "inline" ], + "buildOptions": [ "optimize", "inline", "verbose" ], + "buildRequirements": [ "allowWarnings" ] + }, + "ldmd2": { + "dflags": [ "-O2", "-boundscheck=on", "-J=views", "-I=src/doc_reform", "-color=on" ], + "buildOptions": [ "optimize", "inline", "verbose" ], + "buildRequirements": [ "allowWarnings" ] + }, + "gdc": { + "dflags": [ "-O2", "-J=views", "-I=src/doc_reform" ], + "buildOptions": [ "optimize", "inline" ], + "buildRequirements": [ "allowWarnings" ] + }, + "gdmd": { + "dflags": [ "-O2", "-J=views", "-I=src/doc_reform" ], + "buildOptions": [ "optimize", "inline" ], "buildRequirements": [ "allowWarnings" ] } }, @@ -35,8 +50,8 @@ { "name": "d2sqlite3", "description": "A thin wrapper around SQLite 3", - "homepage": "https://github.com/dlang-community/d2sqlite3", - "authors": [ "Nicolas Sicard", "Other contributors: see Github repo" ], + "homepage": "https://github.com/dlang-community/d2sqlite3", + "authors": [ "Nicolas Sicard", "Other contributors: see Github repo" ], "copyright": "Copyright 2011-18 Nicolas Sicard", "license": "BSL-1.0", "sourcePaths": [ "./src/ext_depends/d2sqlite3/source" ], @@ -61,15 +76,15 @@ "importPaths": [ "./src/ext_depends/imageformats" ] }, { - "name": "dyaml", + "name": "dyaml", "description": "YAML parser and emitter", "authors": [ "Ferdinand Majerech", "Cameron \"Herringway\" Ross" ], - "license": "BSL-1.0", - "homepage": "https://github.com/dlang-community/D-YAML", - "copyright": "Copyright © 2011-2018, Ferdinand Majerech", + "license": "BSL-1.0", + "homepage": "https://github.com/dlang-community/D-YAML", + "copyright": "Copyright © 2011-2018, Ferdinand Majerech", "sourcePaths": [ "./src/ext_depends/D-YAML/source", "./src/ext_depends/tinyendian/source" @@ -90,12 +105,20 @@ "targetName": "spine" }, { - "name": "ldc", + "name": "ldc2", + "targetName": "spine-ldc" + }, + { + "name": "ldmd2", "targetName": "spine-ldc" }, { "name": "dmd", "targetName": "spine-dmd" + }, + { + "name": "gdc", + "targetName": "spine-gdc" } ] } @@ -17,15 +17,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1671837212, - "narHash": "sha256-16nCDyLIocvo6XZ8CuvExTtfJoF6zrUZOlH4JfGxHOI=", - "owner": "nixos", + "lastModified": 1672428209, + "narHash": "sha256-eejhqkDz2cb2vc5VeaWphJz8UXNuoNoM8/Op8eWv2tQ=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "59cf8b7a71488c65ccbe2b993602a0b5dcf8f5f6", + "rev": "293a28df6d7ff3dec1e61e37cc4ee6e6c0fb0847", "type": "github" }, "original": { - "owner": "nixos", + "owner": "NixOS", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } @@ -1,81 +1,88 @@ { - description = "a sisu like parser and document generator"; - inputs.flake-utils.url = "github:numtide/flake-utils"; - inputs.nixpkgs.url = "github:nixos/nixpkgs"; - #inputs.nixpkgs.url = "/nixpkgs-ra/nixpkgs"; - outputs = { self, nixpkgs, flake-utils }: { - packages.x86_64-linux.spine = - let - pkgs = import nixpkgs { - system = "x86_64-linux"; + description = "a sisu like parser & document generator"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; # "github:nixos/nixpkgs"; "github:NixOS/nixpkgs/nixpkgs-unstable"; "nixpkgs/nixos-unstable"; "nixpkgs/nixos-21.11"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + outputs = { self, nixpkgs, flake-utils }: + let + version = "0.12.0"; + 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. + in { + packages = forAllSystems (system: + let pkgs = nixpkgsFor.${system}; + in with pkgs; { + default = stdenv.mkDerivation { + pname = "spine"; + inherit version; + meta.mainProgram = "spine"; + executable = true; + src = self; + shell = ./default.nix; + devEnv = ./devenv.nix; + buildInputs = [ sqlite ]; + nativeBuildInputs = [ dub dmd ]; # [ dub dmd ]; [ dub ldc ]; [ dub gdc ]; + buildPhase = '' + runHook preBuild + HOME="$PWD" + for DC_ in dmd ldmd2 ldc2 gdc gdmd; do + echo "- check for D compiler $DC_" + DC=$(type -P $DC_ || echo "") + if [ ! "$DC" == "" ]; then break; fi + done + if [ "$DC" == "" ]; then exit "Error: could not find D compiler"; fi + echo "$DC_ used as D compiler to build $pname" + dub build --compiler=$DC --build=$DC_ --combined --skip-registry=all + runHook postBuild + ''; + 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 + ''; + postInstall = '' + echo `ls -la $out/bin/spine` + echo " + nix build or nix develop? (suggestions): + - nix build + nix build .#default --print-build-logs + nix flake update; nix build .#default --print-build-logs + nix build --print-build-logs + - nix run + nix run .#default --print-build-logs + nix run default.nix --print-build-logs + - nix shell + nix shell .#default --print-build-logs --command spine -v + - nix develop + nix develop --profile .#default --print-build-logs --command spine -v + nix develop ; eval \"$buildPhase\" + nix develop --build -f derivation.nix -I .envrc --print-build-logs + - nix profile install . --print-build-logs + spine -v + nix-instantiate | nix show-derivation | jq + " + $out/bin/spine -v + ''; + }; + #vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000="; + }); + apps = forAllSystems (system: { + default = { + type = "app"; + program = "${self.packages.${system}.default}/bin/spine"; }; - #targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; - in pkgs.stdenv.mkDerivation { - pname = "spine"; - version = "0.12.0"; - description = "a sisu like parser and document generator"; - inherit self; - src = self; - shell = ./shell.nix; - buildPhase = '' - runHook preBuild - HOME="$PWD" - DFLAGS="-O2 -inline" - 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 build --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 - install -m755 ./bin/spine $out/bin/spine - #cp -r bin/spine $out/bin/. - runHook postInstall - ''; - postInstall = '' - echo `ls -la $out/bin/spine` - echo "" - echo "nix build or nix develop? (suggestions):" - echo '- nix build' - echo ' nix build .#spine --print-build-logs' - echo ' nix build --print-build-logs' - echo '- nix run' - echo ' nix run .#spine --print-build-logs' - echo ' nix run default.nix --print-build-logs' - echo '- nix shell' - echo ' nix shell --print-build-logs --command spine -v' - echo '- nix develop' - echo ' nix develop --build -f derivation.nix -I .envrc --print-build-logs' - echo ' nix develop ; eval "$buildPhase"' - echo 'spine -v' - echo 'nix-instantiate | nix show-derivation | jq' - echo `ls -la $out/bin/spine` - echo "built:" - $out/bin/spine -v - ''; - nativeBuildInputs = with pkgs; [ ldc dub ]; - buildInputs = with pkgs; [ sqlite ]; - }; - packages.x86_64-linux.default = self.packages.x86_64-linux.spine; + }); + devShells = forAllSystems (system: + let pkgs = nixpkgsFor.${system}; + in with pkgs; { + devShell = mkShell { buildInputs = [ git dub dmd ldc gdc sqlite ]; }; + }); }; } - -#nix flake update -#nix flake check -#nix flake show -#nix develop -#nix build .#default --print-build-logs @@ -50,7 +50,7 @@ data/pod/un_contracts_international_sale_of_goods_convention_1980 \ data/pod/viral_spiral.david_bollier # SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND = \ # find data/sisudir/media/text -name *.ss[tm] | sort | xargs -# +# # SiSU_MARKUP_SAMPLES_DIR = \ # data/sisudir/media/text/accelerando.charles_stross.sst \ # data/sisudir/media/text/alices_adventures_in_wonderland.lewis_carroll.sst \ @@ -78,7 +78,7 @@ data/pod/viral_spiral.david_bollier # data/sisudir/media/text/two_bits.christopher_kelty.sst \ # data/sisudir/media/text/un_contracts_international_sale_of_goods_convention_1980.sst \ # data/sisudir/media/text/viral_spiral.david_bollier.sst -# +# Date := `date "+%Y%m%d"` SpineBIN := "${SpineBIN}" # './result/bin' SpineOUT := "${SpineOUT}" # '/srv/www/spine' @@ -446,13 +446,13 @@ depends_set: depends_get # markup_samples: # find data/pod -name pod.manifest | cut -f 1-3 -d / | sort; \ # find data/sisudir/media/text -name *.ss[tm] | sort -# +# # markup_pod_samples: # find data/pod -name pod.manifest | cut -f 1-3 -d / | sort -# +# # markup_dir_samples: # find data/sisudir/media/text -name *.ss[tm] | sort -# +# version_tag: echo "DRV=0.12.0; git tag -f doc-reform_v$$\{DRV} -m\"doc-reform $$\{DRV}\" HEAD" && \ echo "git tag -f doc-reform_v0.12.0 -m\"doc-reform spine-0.12.0\" HEAD" @@ -1156,7 +1156,7 @@ nix-shell-pure: # nix-shell (with local tools, presumably latest dlang compiler & build tools (ldc & dub)) nix-shell-updated: - nix-shell -I nixpkgs=/nixpkgs-ra/nixpkgs --pure + nix-shell -I nixpkgs=/nix/nixpkgs --pure # shell.nix (with shebang) shell: @@ -1198,7 +1198,7 @@ _flake-show-derivation: nix show-derivation |jq; nix-develop: - nix develop -f default.nix -I nixpkgs=/nixpkgs-ra/nixpkgs + nix develop -f default.nix -I nixpkgs=/nix/nixpkgs # nix flake show flake-show: _flake-show-package _flake-show-name _flake-show-derivation @@ -1217,7 +1217,7 @@ flake-build-debug: # nix-build spine (with local tools, presumably latest dlang compiler & build tools (ldc & dub)) flake-build-use-tools-new: - nix build --print-build-logs -I nixpkgs=/nixpkgs-ra/nixpkgs + nix build --print-build-logs -I nixpkgs=/nix/nixpkgs # tangle-build-flake flake-tangle-build: org-tangle flake-build diff --git a/org/config_dub.org b/org/config_dub.org index 0384378..13f57ff 100644 --- a/org/config_dub.org +++ b/org/config_dub.org @@ -66,12 +66,27 @@ "buildTypes": { "dmd": { "dflags": [ "-J=views", "-I=src/doc_reform" ], - "buildOptions": [ "verbose", "inline" ], + "buildOptions": [ "inline", "verbose" ], "buildRequirements": [ "allowWarnings" ] }, - "ldc": { + "ldc2": { "dflags": [ "-O2", "-J=views", "-I=src/doc_reform" ], - "buildOptions": [ "verbose", "optimize", "inline" ], + "buildOptions": [ "optimize", "inline", "verbose" ], + "buildRequirements": [ "allowWarnings" ] + }, + "ldmd2": { + "dflags": [ "-O2", "-boundscheck=on", "-J=views", "-I=src/doc_reform", "-color=on" ], + "buildOptions": [ "optimize", "inline", "verbose" ], + "buildRequirements": [ "allowWarnings" ] + }, + "gdc": { + "dflags": [ "-O2", "-J=views", "-I=src/doc_reform" ], + "buildOptions": [ "optimize", "inline" ], + "buildRequirements": [ "allowWarnings" ] + }, + "gdmd": { + "dflags": [ "-O2", "-J=views", "-I=src/doc_reform" ], + "buildOptions": [ "optimize", "inline" ], "buildRequirements": [ "allowWarnings" ] } }, @@ -84,8 +99,8 @@ { "name": "d2sqlite3", "description": "A thin wrapper around SQLite 3", - "homepage": "https://github.com/dlang-community/d2sqlite3", - "authors": [ "Nicolas Sicard", "Other contributors: see Github repo" ], + "homepage": "https://github.com/dlang-community/d2sqlite3", + "authors": [ "Nicolas Sicard", "Other contributors: see Github repo" ], "copyright": "Copyright 2011-18 Nicolas Sicard", "license": "BSL-1.0", "sourcePaths": [ "./src/ext_depends/d2sqlite3/source" ], @@ -110,15 +125,15 @@ "importPaths": [ "./src/ext_depends/imageformats" ] }, { - "name": "dyaml", + "name": "dyaml", "description": "YAML parser and emitter", "authors": [ "Ferdinand Majerech", "Cameron \"Herringway\" Ross" ], - "license": "BSL-1.0", - "homepage": "https://github.com/dlang-community/D-YAML", - "copyright": "Copyright © 2011-2018, Ferdinand Majerech", + "license": "BSL-1.0", + "homepage": "https://github.com/dlang-community/D-YAML", + "copyright": "Copyright © 2011-2018, Ferdinand Majerech", "sourcePaths": [ "./src/ext_depends/D-YAML/source", "./src/ext_depends/tinyendian/source" @@ -139,12 +154,20 @@ "targetName": "spine" }, { - "name": "ldc", + "name": "ldc2", + "targetName": "spine-ldc" + }, + { + "name": "ldmd2", "targetName": "spine-ldc" }, { "name": "dmd", "targetName": "spine-dmd" + }, + { + "name": "gdc", + "targetName": "spine-gdc" } ] } diff --git a/org/config_git.org b/org/config_git.org index 328a192..303b4e7 100644 --- a/org/config_git.org +++ b/org/config_git.org @@ -30,11 +30,9 @@ ,* !.gitignore !.gitattributes -!*.nix -!nix !nix/** !*.nix -#!flake.lock +!flake.lock !.envrc !README.md !README @@ -53,7 +51,6 @@ !*.d !*.rb !*.txt -!conf.sdl !doc !doc/** !man @@ -93,6 +90,7 @@ notes/** ,**/cgi-bin/** tmp/** ,*_.org +,*_.nix ,*_.d ,*_.txt ,*_ @@ -107,3 +105,15 @@ tmp/** #*.\#* #.reggae/** #+END_SRC + +** gitattributes :gitattributes: + +#+HEADER: :tangle "../.gitattributes" +#+BEGIN_SRC sh +/org export-ignore +/subprojects export-ignore +/build export-ignore +.gitattributes export-ignore +tangle export-ignore +flake.lock export-ignore +#+END_SRC diff --git a/org/config_make.org b/org/config_make.org index cfbd01a..5451130 100644 --- a/org/config_make.org +++ b/org/config_make.org @@ -1628,7 +1628,7 @@ nix-shell-pure: # nix-shell (with local tools, presumably latest dlang compiler & build tools (ldc & dub)) nix-shell-updated: - nix-shell -I nixpkgs=/nixpkgs-ra/nixpkgs --pure + nix-shell -I nixpkgs=/nix/nixpkgs --pure # shell.nix (with shebang) shell: @@ -1670,7 +1670,7 @@ _flake-show-derivation: nix show-derivation |jq; nix-develop: - nix develop -f default.nix -I nixpkgs=/nixpkgs-ra/nixpkgs + nix develop -f default.nix -I nixpkgs=/nix/nixpkgs # nix flake show flake-show: _flake-show-package _flake-show-name _flake-show-derivation @@ -1689,7 +1689,7 @@ flake-build-debug: # nix-build spine (with local tools, presumably latest dlang compiler & build tools (ldc & dub)) flake-build-use-tools-new: - nix build --print-build-logs -I nixpkgs=/nixpkgs-ra/nixpkgs + nix build --print-build-logs -I nixpkgs=/nix/nixpkgs # tangle-build-flake flake-tangle-build: org-tangle flake-build @@ -1732,8 +1732,8 @@ gitsnapshot: distclean tangle #+HEADER: :NO-tangle ../.env/local #+BEGIN_SRC sh export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos -#export NIX_PATH=nixpkgs=/nixpkgs-ra/nixpkgs -#export NIX_PATH=/nixpkgs-ra/nixpkgs +#export NIX_PATH=nixpkgs=/nix/nixpkgs +#export NIX_PATH=/nix/nixpkgs # reload when these files change # watch_file flake.nix # watch_file flake.lock diff --git a/org/config_nix.org b/org/config_nix.org index 86c61ee..50583a1 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -19,50 +19,7 @@ #+NAME: nixpkgs_local #+BEGIN_SRC sh -/nixpkgs-ra/nixpkgs -#+END_SRC - -** NOTES -*** nix-shell - -- default.nix - -#+BEGIN_SRC sh -nix-shell -nix-build -#+END_SRC - -- project.nix - -#+BEGIN_SRC sh -nix-shell -nix-build project.nix -#+END_SRC - -*** nix-shell --pure - -- default.nix - -#+HEADER: :noweb yes -#+BEGIN_SRC sh -nix-shell --pure -nix-build -I nixpkgs=<<nixpkgs_local>> -nix-build -I .envrc -#+END_SRC - -#+BEGIN_SRC sh -nix build -f default.nix --print-build-logs -nix build -f derivation.nix --print-build-logs -nix shell -f default.nix --print-build-logs -# nix build -f project.nix -# nix build -f spine.nix -nix develop --build -f derivation.nix -I .envrc --print-build-logs -#+END_SRC - -*** derivation .drv - -#+BEGIN_SRC sh -nix show-derivation /nix/store/q7n14bm8j5vzm62qaraczdb4bpyf59vv-spine-0.11.1.drv +/srv/nix/nixpkgs #+END_SRC ** spine @@ -78,89 +35,43 @@ nix show-derivation /nix/store/q7n14bm8j5vzm62qaraczdb4bpyf59vv-spine-0.11.1.drv #+HEADER: :tangle ../.envrc #+BEGIN_SRC sh +# nix_direnv_watch_file provided-filename use flake . NIX_ENFORCE_PURITY=1 -NixDirEnvVersion="2.1.2" +NixDirEnvVersion="2.2.0" if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then # - https://github.com/nix-community/nix-direnv # source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-0000000000000000000000000000000000000000000=" - source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-ytpQmMcUBR2czh8kGOqn/dmD6u55m3lDbeu/G8HGD7A=" + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-5EwyKnkJNQeXrRkYbwwRBcXbibosCJqyIUuz9Xq+LRc=" fi if [ -f .envrc-local ]; then source_env_if_exists .envrc-local || source .envrc-local fi #+END_SRC -- lorri? - -#+HEADER: :NO-tangle ../.envrc -#+BEGIN_SRC sh -if type lorri &>/dev/null; then - echo "direnv: using lorri from PATH ($(type -p lorri))" - # eval "$(lorri direnv)" -else # fallback prevent bootstrapping problems by using direnv's builtin nix support - use nix - NIX_ENFORCE_PURITY=0 -fi -if [ -f .envrc-local ]; then - source_env_if_exists .envrc-local || source .envrc-local -fi -#+END_SRC - -- enable flakes - -#+HEADER: :NO-tangle ../.envrc -#+BEGIN_SRC sh -if [ -f flake.lock ] && [ -f flake.nix ]; then - # reload when these files change - watch_file flake.nix - watch_file flake.lock - # load the flake devShell - if [ ! -d $(direnv_layout_dir) ]; then - mkdir $(direnv_layout_dir) - fi - eval "$(nix --experimental-features 'nix-command flakes' print-dev-env --profile "$(direnv_layout_dir)/flake-profile")" -else - # fall back to using direnv's builtin nix support - # to prevent bootstrapping problems. - # use nix - if type lorri &>/dev/null; then - echo "direnv: using lorri from PATH ($(type -p lorri))" - eval "$(lorri direnv)" - else - # fall back to using direnv's builtin nix support - # to prevent bootstrapping problems. - use nix - NIX_ENFORCE_PURITY=0 - fi - if [ -f .envrc-local ]; then - source_env_if_exists .envrc-local || source .envrc-local - fi -fi -#+END_SRC - **** .envrc-local CHECK MODIFY - bespoke modify appropriately and generate if needed #+HEADER: :tangle ../.envrc-local_ #+HEADER: :noweb yes -#+BEGIN_SRC nix -echo ".envrc called .envrc-local" +#+BEGIN_SRC sh +# reload when these files change +watch_file flake.lock +watch_file flake.nix +nix flake update; nix flake check; nix flake show +#use flake .#default PATH_add result/bin export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos -#export NIX_PATH=nixpkgs=/nixpkgs/nixpkgs -#export NIX_PATH=/nixpkgs/nixpkgs +#export NIX_PATH=/srv/nix/nixpkgs +#export NIX_PATH=nixpkgs=/srv/nix/nixpkgs export DFLAGS="-O2 -inline -boundscheck=on -color=on" -# reload when these files change -# watch_file flake.nix -# watch_file flake.lock ## load the flake devShell # eval "$(nix print-dev-env)" # echo $NIX_BUILD_TOP export Date=`date "+%Y%m%d"` export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g') -export SpinePROJ=~/grotto/repo/git.repo/projects/project-spine/doc-reform +export SpinePROJ=~/grotto/repo/git.repo/projects/doc-reform/code/software/spine export SpineSRC=$SpinePROJ/src export SpineBIN=$SpinePROJ/result/bin export SpineDOC=~/grotto/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples @@ -175,295 +86,183 @@ export SpineCGIform='spine_search' export SpineSQLdb='spine.search.db' export PROG_VER_GIT="`git describe --long --tags | sed -e 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g'`" export PROG_VER_DECLARED="`cat ./views/version.txt | grep --color=never "enum" | sed 's/.\+(\([0-9]\+\),[ \t]\+\([0-9]\+\),[ \t]\+\([0-9]\+\)[ \t]*).\+/\1.\2.\3/g'`" -#direnv allow #+END_SRC -**** .env/echo-nixNote CHECK MODIFY - -#+HEADER: :tangle ../.env/echo-nixNote -#+BEGIN_SRC sh -echo '-*- mode: org -*- - -,* nixpkgs path? - - # eval "$(nix print-dev-env)" -' > nixNote_.org - -echo " <nixpkgs> == `nix-instantiate --find-file nixpkgs`" >> nixNote_.org - -echo ' -,* nix build and show derivation - -,#+BEGIN_SRC sh -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 sh -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 sh -$SpineBIN/spine --very-verbose --pod --source --output="$SpineOUTversioned" $SpinePOD/* -,#+END_SRC - -,*** html & epub output - -,#+BEGIN_SRC sh -$SpineBIN/spine --very-verbose --html --epub --output="$SpineOUTversioned" $SpinePOD/* -,#+END_SRC - -,*** sqlite db for each document - populate each db - -,#+BEGIN_SRC sh -$SpineBIN/spine --very-verbose --sqlite-discrete --output="$SpineOUTversioned" $SpinePOD/* -,#+END_SRC - -,*** doc source; html, epub; sqlite outputs - -,#+BEGIN_SRC sh -$SpineBIN/spine --verbose --pod --html --epub --sqlite-discrete --output="$SpineOUTversioned" $SpinePOD/* -,#+END_SRC - -,*** curate (authors topics) - -,#+BEGIN_SRC sh -$SpineBIN/spine --very-verbose --curate --output="$SpineOUTversioned" $SpinePOD/* -,#+END_SRC - -,*** html, curate - -,#+BEGIN_SRC sh -$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 sh -$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 sh -$SpineBIN/spine --very-verbose --sqlite-db-create --output="$SpineOUTversioned" -,#+END_SRC - -,*** sqlite db (shared) - populate db - -,#+BEGIN_SRC sh -$SpineBIN/spine --very-verbose --sqlite-update --output="$SpineOUTversioned" $SpineDOC/spine-markup-samples/markup/pod/* -,#+END_SRC - -,*** sqlite db (shared) - drop db - -,#+BEGIN_SRC sh -$SpineBIN/spine --very-verbose --sqlite-db-drop --output="$SpineOUTversioned" -,#+END_SRC - -,*** sqlite db (shared) - create & populate db (single step) - -,#+BEGIN_SRC sh -$SpineBIN/spine --very-verbose --sqlite-db-create --sqlite-update --output="$SpineOUTversioned" $SpinePOD/* -,#+END_SRC - -,*** composite command: source pod, html, epub, curate, sqlite - -,#+BEGIN_SRC sh -$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 sh -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 sh -$SpineBIN/spine --very-verbose --sqlite-db-create --output="$SpineOUT" $SpinePOD/* - -$SpineBIN/spine -v --cgi-search-form-codegen --output=$SpineOUT $SpinePOD/* - -$SpineBIN/spine -v --show-config --config=$SpinePOD/.dr - -$SpineBIN/spine --html $SpinePOD/* - - -$SpineBIN/spine -v --cgi-search-form-codegen --config=$SpinePOD/.dr/config_local_site -,#+END_SRC - -,*** generate html linked to search form - -,#+BEGIN_SRC sh -$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 sh -$SpineBIN/spine -v --sqlite-db-create --sqlite-db-filename="<<spine_search_db>>" --sqlite-db-path="$SpineDBpath" -$SpineBIN/spine -v --sqlite-db-recreate --sqlite-db-filename="<<spine_search_db>>" --sqlite-db-path="$SpineDBpath" -,#+END_SRC - -,*** populate sqlite db - -,#+BEGIN_SRC sh -$SpineBIN/spine -v --sqlite-update --sqlite-db-filename="<<spine_search_db>>" --output=$SpineOUT $SpinePOD/* -,#+END_SRC - -,*** generate html (linked to search form), sql output, curate COMPOSITE - -,#+BEGIN_SRC sh -$SpineBIN/spine -v --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename="<<spine_search_db>>" --cgi-sqlite-search-filename="<<spine_search_cgi>>" --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 sh -$SpineBIN/spine -v --html --html-link-search --html-link-curate --curate --sqlite-update $SpinePOD/* -,#+END_SRC +*** flake :flake: +**** flake +***** flake.nix -,#+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: "<<spine_search_cgi>>" - cgi_action: "https://sisudoc.org/spine_search" - db_sqlite_filename: "<<spine_search_db>>" - db_sqlite_path: "/var/www/sqlite" -,#+END_SRC +#+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"; # "github:nixos/nixpkgs"; "github:NixOS/nixpkgs/nixpkgs-unstable"; "nixpkgs/nixos-unstable"; "nixpkgs/nixos-21.11"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + outputs = { self, nixpkgs, flake-utils }: + let + version = "<<spine_version_set>>"; + 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. + in { + packages = forAllSystems (system: + let pkgs = nixpkgsFor.${system}; + in with pkgs; { + default = stdenv.mkDerivation { + pname = "spine"; + inherit version; + meta.mainProgram = "spine"; + executable = true; + src = self; + shell = ./default.nix; + devEnv = ./devenv.nix; + buildInputs = [ sqlite ]; + nativeBuildInputs = [ dub dmd ]; # [ dub dmd ]; [ dub ldc ]; [ dub gdc ]; + <<flake_phases>> + }; + #vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000="; + }); + apps = forAllSystems (system: { + default = { + type = "app"; + program = "${self.packages.${system}.default}/bin/spine"; + }; + }); + devShells = forAllSystems (system: + let pkgs = nixpkgsFor.${system}; + in with pkgs; { + devShell = mkShell { buildInputs = [ git dub dmd ldc gdc sqlite ]; }; + }); + }; +} +#+END_SRC -,*** make search form +**** some other possible flakes (samples) +***** flake 0 -,#+BEGIN_SRC sh -$SpineBIN/spine -v --cgi-search-form-codegen --config=$SpinePOD/.dr/config_local_site -,#+END_SRC +#+NAME: flake_0 +#+HEADER: :noweb yes +#+BEGIN_SRC nix +{ + description = "a sisu like parser & document generator"; + inputs.<<flake_inputs_nix>> + outputs = { <<flake_outputs>> }: { + <<flake_output_spine>> + <<flake_output_default>> + }; +} +#+END_SRC -,*** latex +***** flake single system -,#+BEGIN_SRC sh -$SpineBIN/spine --latex --serial --output="$SpineOUT" $SpinePOD/* -ls $SpineOutstatic/latex/*.tex -,#+END_SRC -' >> nixNote_.org +#+NAME: flake_single_sytem +#+HEADER: :tangle ../flake-1-single-system_.nix +#+HEADER: :noweb yes +#+BEGIN_SRC nix +{ + description = "a sisu like parser & document generator"; + inputs.<<flake_inputs_nix>> + outputs = { <<flake_outputs>> }: { + packages.x86_64-linux.spine = + let + pkgs = import nixpkgs { + system = "x86_64-linux"; + }; + #targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; + in pkgs.stdenv.mkDerivation { + <<flake_metadata>> + inherit self; + src = self; + #shell = ./shell.nix; + shell = ./default.nix; + devEnv = ./devenv.nix; + <<flake_phases>> + buildInputs = [ sqlite ]; + nativeBuildInputs = with pkgs; [ dub <<d-compiler>> ]; # [ dmd dub ]; [ ldc dub ]; [ gdc dub ]; + }; + <<flake_output_default>> + }; +} +#+END_SRC -#cat nixNote_.org +***** flake 2 -#echo "emacs nixNote_.org" -#echo "cat nixNote_.org" +#+NAME: flake_2 +#+HEADER: :tangle ../flake-2_.nix +#+HEADER: :noweb yes +#+BEGIN_SRC nix +{ + description = "a sisu like parser & document generator"; + inputs.<<flake_inputs_nix>> + outputs = { <<flake_outputs>> }: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + }; + #lib = nixpkgs.lib; + in { + packages.x86_64-linux.spine = pkgs.stdenv.mkDerivation { + inherit system; + <<flake_metadata>> + inherit self; + src = self; + #shell = ./shell.nix; + shell = ./default.nix; + devEnv = ./devenv.nix; + <<flake_phases>> + buildInputs = [ sqlite ]; + nativeBuildInputs = with pkgs; [ dub <<d-compiler>> ]; # [ dub dmd ]; [ dub ldc ]; [ dub gdc ]; + }; + <<flake_output_default>> + }; +} #+END_SRC -*** makefile +***** flake (multi-system) -#+HEADER: :tangle ../makefile_ -#+BEGIN_SRC make -buildPhase: - HOME=$${PWD}; \ - for DC_ in dmd ldmd2 gdmd; do \ - echo "- check for D compiler $${DC_}"; \ - DC=$$(type -P $${DC_} || echo ""); \ - if [ ! "$${DC}" == "" ]; then \ - break; \ - fi; \ - done; \ - echo "D compiler = $${DC}"; \ - if [ "$${DC}" == "" ]; then \ - echo "Error: could not find D compiler"; \ - exit 1; \ - fi; \ - echo "$${DC_} used as D compiler to build $${pname}"; \ - export DFLAGS="-O2 -inline"; \ - dub build --compiler=$${DC} --build=release --combined --skip-registry=all; -checkPhase: - runHook preCheck; \ - HOME=$${PWD}; \ - dub test --combined --skip-registry=all; \ - runHook postCheck -installPhase: - runHook preInstall; \ - mkdir -p $${out}/bin; \ - install -m755 ./bin/spine $${out}/bin/spine; \ - runHook postInstall - #cp -r bin/spine $out/bin/. -postInstall: - echo "$${out}/share/cgi-bin"; \ - echo `ls -la $${out}/bin/spine` +#+NAME: flake_multi_system_possible +#+HEADER: :tangle ../flake-0-multi-system_.nix +#+HEADER: :noweb yes +#+BEGIN_SRC nix +{ + description = "a sisu like parser & document generator"; + inputs.<<flake_inputs_nix>> + outputs = { <<flake_outputs>> }: + let + version = "<<spine_version_set>>"; + supportedSystems = [ "x86_64-linux" ]; # [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + # helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); # nixpkgs instantiated for supported system types. + <<flake_devshells>> + in { + packages = forAllSystems (system: + let + pkgs = nixpkgsFor.${system}; + in { + default = pkgs.stdenv.mkDerivation { + pname = "spine"; + inherit version; + src = self; + shell = ./default.nix; + devEnv = ./devenv.nix; + <<flake_phases>> + buildInputs = [ sqlite ]; + nativeBuildInputs = with pkgs; [ dub <<d-compiler>> ]; # [ dub dmd ]; [ dub ldc ]; [ dub gdc ]; + }; + #vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000="; + }); + }; +} #+END_SRC *** flake :flake: +**** notes? - flake.nix - /nixpkgs-ra/nixpkgs + /srv/nix/nixpkgs ./shell.nix - shell.nix ./pkgs/shell-pkgs.nix @@ -483,6 +282,7 @@ postInstall: - nix build -f default.nix --print-build-logs - nix shell -f default.nix --print-build-logs - nix develop --build -f derivation.nix -I .envrc --print-build-logs +- nix develop --profile .#default --print-build-logs --command spine -v - nix search --json 2>/dev/null |jq - nix flake show @@ -490,98 +290,214 @@ postInstall: # nix-instantiate | nix-build -#+HEADER: :tangle ../flake.nix -#+HEADER: :noweb yes -#+BEGIN_SRC nix -{ - description = "a sisu like parser and document generator"; - inputs.flake-utils.url = "github:numtide/flake-utils"; - inputs.nixpkgs.url = "github:nixos/nixpkgs"; - #inputs.nixpkgs.url = "/nixpkgs-ra/nixpkgs"; - outputs = { self, nixpkgs, flake-utils }: { - packages.x86_64-linux.spine = - let - pkgs = import nixpkgs { - system = "x86_64-linux"; - }; - #targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; - in pkgs.stdenv.mkDerivation { - pname = "spine"; - version = "<<spine_version_set>>"; - description = "a sisu like parser and document generator"; - inherit self; - src = self; - shell = ./shell.nix; - buildPhase = '' - runHook preBuild - HOME="$PWD" - DFLAGS="-O2 -inline" - 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 build --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 - install -m755 ./bin/spine $out/bin/spine - #cp -r bin/spine $out/bin/. - runHook postInstall - ''; - postInstall = '' - echo `ls -la $out/bin/spine` - echo "" - echo "nix build or nix develop? (suggestions):" - echo '- nix build' - echo ' nix build .#spine --print-build-logs' - echo ' nix build --print-build-logs' - echo '- nix run' - echo ' nix run .#spine --print-build-logs' - echo ' nix run default.nix --print-build-logs' - echo '- nix shell' - echo ' nix shell --print-build-logs --command spine -v' - echo '- nix develop' - echo ' nix develop --build -f derivation.nix -I .envrc --print-build-logs' - echo ' nix develop ; eval "$buildPhase"' - echo 'spine -v' - echo 'nix-instantiate | nix show-derivation | jq' - echo `ls -la $out/bin/spine` - echo "built:" - $out/bin/spine -v - ''; - nativeBuildInputs = with pkgs; [ ldc dub ]; - buildInputs = with pkgs; [ sqlite ]; - }; - packages.x86_64-linux.default = self.packages.x86_64-linux.spine; - }; -} - #nix flake update #nix flake check #nix flake show #nix develop #nix build .#default --print-build-logs + +#+BEGIN_SRC nix +src = fetchTarball { + url = "file:///[path]/$(pname)-$(version).tar.gz"; + sha256 = "sha256:0000000000000000000000000000000000000000000000000000"; +}; +#+END_SRC + +**** flake parts +***** flake metadata + +#+NAME: flake_metadata +#+HEADER: :noweb yes +#+BEGIN_SRC nix +pname = "spine"; +version = "<<spine_version_set>>"; +description = "a sisu like parser and document generator"; +#+END_SRC + +***** flake inputs +****** flake inputs static + +#+NAME: flake_inputs_nix +#+HEADER: :noweb yes +#+BEGIN_SRC nix +nixpkgs.url = "github:nixos/nixpkgs"; +flake-utils.url = "github:numtide/flake-utils"; +#+END_SRC + +****** flake inputs for dub2nix + +#+NAME: flake_inputs_dub2nix +#+HEADER: :noweb yes +#+BEGIN_SRC nix +flake-utils.url = "github:numtide/flake-utils"; +nixpkgs.url = "github:nixos/nixpkgs"; +d2sqlite3-src = { url = "github:dlang-community/d2sqlite3"; flake = false; }; +tinyendian-src = { url = "github:kiith-sa/tinyendian"; flake = false; }; +dyaml-src = { url = "github:dlang-community/D-YAML"; flake = false; }; +imageformats-src = { url = "github:lgvz/imageformats"; flake = false; }; +dub2nix-src = { url = "github:lionello/dub2nix"; flake = false; }; +#+END_SRC + +***** flake outputs +****** flake outputs static + +#+NAME: flake_outputs +#+HEADER: :noweb yes +#+BEGIN_SRC nix +self, nixpkgs, flake-utils +#+END_SRC + +****** flake outputs for dub2nix + +#+NAME: flake_outputs_dub2nix +#+HEADER: :noweb yes +#+BEGIN_SRC nix +self, nixpkgs, flake-utils, dub2nix-src, d2sqlite3-src, tinyendian-src, dyaml-src, imageformats-src +#+END_SRC + +***** flake devshells + +#+NAME: flake_devshells +#+HEADER: :noweb yes +#+BEGIN_SRC nix +devShells = forAllSystems (system: + let pkgs = nixpkgsFor.${system}; + in { + default = pkgs.mkShell { + buildInputs = with pkgs; [ git dub dmd ldc sqlite ]; + }; +}); +#+END_SRC + +***** flake phases + +#+NAME: flake_phases +#+HEADER: :noweb yes +#+BEGIN_SRC nix +buildPhase = '' + runHook preBuild + HOME="$PWD" + for DC_ in dmd ldmd2 ldc2 gdc gdmd; do + echo "- check for D compiler $DC_" + DC=$(type -P $DC_ || echo "") + if [ ! "$DC" == "" ]; then break; fi + done + if [ "$DC" == "" ]; then exit "Error: could not find D compiler"; fi + echo "$DC_ used as D compiler to build $pname" + dub build --compiler=$DC --build=$DC_ --combined --skip-registry=all + runHook postBuild +''; +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 +''; +postInstall = '' + echo `ls -la $out/bin/spine` + echo " + nix build or nix develop? (suggestions): + - nix build + nix build .#default --print-build-logs + nix flake update; nix build .#default --print-build-logs + nix build --print-build-logs + - nix run + nix run .#default --print-build-logs + nix run default.nix --print-build-logs + - nix shell + nix shell .#default --print-build-logs --command spine -v + - nix develop + nix develop --profile .#default --print-build-logs --command spine -v + nix develop ; eval \"$buildPhase\" + nix develop --build -f derivation.nix -I .envrc --print-build-logs + - nix profile install . --print-build-logs + spine -v + nix-instantiate | nix show-derivation | jq + " + $out/bin/spine -v +''; +#+END_SRC + +***** flake output default + +#+NAME: flake_output_default +#+HEADER: :noweb yes +#+BEGIN_SRC nix +packages.x86_64-linux.default = self.packages.x86_64-linux.spine; +#+END_SRC + +#+NAME: flake_output_spine +#+HEADER: :noweb yes +#+BEGIN_SRC nix +packages.x86_64-linux.spine = + let + pkgs = import nixpkgs { + system = "x86_64-linux"; + }; + #targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; + in pkgs.stdenv.mkDerivation { + <<flake_metadata>> + inherit self; + src = self; + #shell = ./shell.nix; + shell = ./default.nix; + devEnv = ./devenv.nix; + <<flake_phases>> + buildInputs = [ sqlite ]; + nativeBuildInputs = with pkgs; [ <<d-compiler>> dub ]; # [ dmd dub ]; [ ldc dub ]; [ gdc dub ]; + }; +#+END_SRC + +***** d-compiler (dmd ldc gdc) + +- dmd ldc gdc + +#+NAME: d-compiler +#+HEADER: :noweb yes +#+BEGIN_SRC nix +dmd #+END_SRC +***** flake spine dub2nix + +#+NAME: flake_output_spine_dub2nix +#+HEADER: :noweb yes +#+BEGIN_SRC nix +packages.x86_64-linux.spine = + let + pkgs = import nixpkgs { + system = "x86_64-linux"; + }; + #targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; + in + pkgs.stdenv.mkDerivation { + pname = "spine"; + version = "<<spine_version_set>>"; + description = "a sisu like parser and document generator"; + inherit self; + src = self; + shell = ./shell.nix; + <<flake_phases>> + buildInputs = [ sqlite ]; + nativeBuildInputs = with pkgs; [ dub ldc ]; + }; +#+END_SRC + +***** flake misc + #+BEGIN_SRC nix src = fetchTarball { url = "file:///[path]/$(pname)-$(version).tar.gz"; sha256 = "sha256:0000000000000000000000000000000000000000000000000000"; }; #+END_SRC + #+HEADER: :noweb yes #+BEGIN_SRC nix { @@ -700,7 +616,7 @@ mkShell { # ### i18n translation related # perl534Packages.Po4a ### candy - starship + #starship ]; shellHook = '' #if [[ -f ".envrc" ]]; then @@ -730,7 +646,7 @@ mkShell { nix build .#default --print-build-logs |& nom - nix run - nix run .#spine --print-build-logs + nix run .#default --print-build-logs nix run default.nix --print-build-logs - nix shell @@ -747,7 +663,7 @@ mkShell { nix-instantiate | nix show-derivation | jq nix-build . --no-out-link | xargs -o nix-tree - nix-tree --derivation .#spine + nix-tree --derivation .#default " #echo "ldc `${pkgs.ldc}/bin/ldc2 -v`" @@ -765,19 +681,19 @@ mkShell { # [ nix-shell ] - # - nix-shell -I nixpkgs=/nixpkgs-ra/nixpkgs --pure - # - nix-shell -p "with import /nixpkgs-ra/nixpkgs {}; ldc" --pure - # - nix-shell -p "with import /nixpkgs-ra/nixpkgs {}; [dub ldc]" --pure + # - nix-shell -I nixpkgs=/srv/nix/nixpkgs --pure + # - nix-shell -p "with import /srv/nix/nixpkgs {}; ldc" --pure + # - nix-shell -p "with import /srv/nix/nixpkgs {}; [dub ldc]" --pure # - nix-shell -p nixVersions.unstable #nixFlakes # - nix-shell -p nixFlakes --pure - # - nix-shell -p nixFlakes --pure -p "with import /nixpkgs-ra/nixpkgs {}; [nix dub ldc git ps]" + # - nix-shell -p nixFlakes --pure -p "with import /srv/nix/nixpkgs {}; [nix dub ldc git ps]" # - nix-shell shell.nix direnv: export +IN_NIX_SHELL # - nix-shell shell.nix # [ nix-build ] - # - nix-build -I nixpkgs=/nixpkgs-ra/nixpkgs # --pure + # - nix-build -I nixpkgs=/srv/nix/nixpkgs # --pure # - nix-build -I .envrc --pure # - nix-build default.nix -I .envrc && result/bin/spine -v @@ -805,18 +721,18 @@ mkShell { # - nix build `nix-instantiate -I .envrc` # - nix build -f default.nix && ./result/bin/spine -v && noti -t "spine build" -m "see ./result/bin/spine" - # - nix build .#spine + # - nix build .#default # [ nix run ] # - nix run default.nix --print-build-logs # - nix run -I .envrc default.nix --print-build-logs - # - nix run .#spine + # - nix run .#default # - nix-shell -I .envrc --pure # - nix develop --build -f derivation.nix -I .envrc --print-build-logs -# - nix-shell -p nixFlakes --pure -p "with import /nixpkgs-ra/nixpkgs {}; [nix dub ldc git ps]" +# - nix-shell -p nixFlakes --pure -p "with import /srv/nix/nixpkgs {}; [nix dub ldc git ps]" # - nix-build # - nix build `nix-instantiate -I .envrc` @@ -838,13 +754,13 @@ mkShell { - nix-shell --pure -I nixpkgs=<<nixpkgs_local>> - nix-shell --pure -p "with import <<nixpkgs_local>> {}; ldc" -- nix-shell --pure -p "with import /nixpkgs-ra/nixpkgs {}; [dub ldc]" +- nix-shell --pure -p "with import /srv/nix/nixpkgs {}; [dub ldc]" - shell.nix direnv: export +IN_NIX_SHELL - nix-shell -p nixFlakes - nix-shell -p nixFlakes --pure -- nix-shell -p nixFlakes --pure -p "with import /nixpkgs-ra/nixpkgs {}; [dub ldc]" +- nix-shell -p nixFlakes --pure -p "with import /srv/nix/nixpkgs {}; [dub ldc]" - shell.nix -I .envrc - nix-shell -I nixpkgs=<provide local nix path> @@ -877,7 +793,7 @@ mkShell { ./result/bin/spine #+END_SRC -**** parts +**** shell parts (packages) ***** packages nix related #+NAME: shell_packages_nix_related @@ -971,32 +887,10 @@ foliate perl534Packages.Po4a #+END_SRC -**** misc - -#+HEADER: :NO-tangle ../shell.nix -#+HEADER: :tangle-mode (identity #o755) -#+HEADER: :shebang "#!/usr/bin/env -S nix-shell" -#+BEGIN_SRC nix -{ pkgs ? import <nixpkgs> {} }: -pkgs.mkShell { - buildInputs = with pkgs; [ - (import ./nix/pkglst/shell-pkgs.nix { inherit pkgs; }) - ]; - buildPhase = "nix build -f default.nix"; - shellHook = '' - echo "built spine @ ./result/bin/spine" - if [[ -f ".envrc" ]]; then - source .envrc - fi - nix-instantiate | nix show-derivation | jq - ''; -} -#+END_SRC - *** default.nix :default: - default.nix -I nixpkgs=<provide local nix path> - e.g. default.nix -I nixpkgs=/nixpkgs-ra/nixpkgs + e.g. default.nix -I nixpkgs=/srv/nix/nixpkgs - nix-build -I nixpkgs=<provide local nix path> e.g. nix-build -I nixpkgs=<<nixpkgs_local>> @@ -1023,7 +917,80 @@ nix develop --build -f derivation.nix -I .envrc --print-build-logs #+HEADER: :shebang "#!/usr/bin/env -S nix-build" #+BEGIN_SRC nix { pkgs ? import <nixpkgs> {} }: -pkgs.callPackage ./derivation.nix {} +pkgs.callPackage ./devenv.nix {} +#+END_SRC + +* devEnv + +nix profile install . + +#+HEADER: :tangle ../devenv.nix +#+HEADER: :tangle-mode (identity #o644) +#+HEADER: :noweb yes +#+BEGIN_SRC nix +# profile.nix +{ pkgs ? import <nixpkgs> { }, name ? "user-env" }: with pkgs; +buildEnv { + inherit name; + extraOutputsToInstall = [ "out" "man" "lib" ]; # to get all needed symlinks + paths = [ + #nix # if not on NixOS, this is needed + direnv + nixVersions.unstable #nixFlakes + nix-prefetch-git + validatePkgConfig + nix-tree jq nix-output-monitor + git + ps + ### d_build_related + dub + ## compiler + dmd + ldc + #gdc + #rund + ## linker + #lld + #mold + ## builder + #ninja + #meson + ### sqlite search related + sqlite + # ### pdf_latex_related + # source-sans-pro + # source-serif-pro + # source-code-pro + # texlive.combined.scheme-full + # ### xml_and_epub_related + # libxml2 + # html-tidy + # xmlstarlet + # epubcheck + # ebook_tools + # epr + # sigil + # calibre #(suite includes: ebook-viewer) + # foliate + # ### i18n translation related + # perl534Packages.Po4a + ### candy + #starship + # 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; + }) + ]; +} #+END_SRC *** derivation.nix :default: @@ -1119,7 +1086,7 @@ mkDubDerivation rec { meta = with pkgs.lib; { description = "A sisu like parser and document generator"; longDescription = '' - A sisu like parser and document generator + a sisu like parser and document generator ''; homepage = "https://sisudoc.org"; license = licenses.agpl3Plus; @@ -1370,7 +1337,7 @@ github:nixos/nixpkgs #+NAME: nixpkgs_path_local #+BEGIN_SRC nix -/nixpkgs-ra/nixpkgs +/srv/nix/nixpkgs #+END_SRC **** project path options @@ -1452,3 +1419,329 @@ fc-query DejaVuSans.ttf | grep '^\s\+family:' | cut -d'"' -f2 $XDG_DATA_HOME/fonts ~/.local/share/fonts #+END_SRC + +** NOTES +*** nix-shell + +- default.nix + +#+BEGIN_SRC sh +nix-shell +nix-build +#+END_SRC + +- project.nix + +#+BEGIN_SRC sh +nix-shell +nix-build project.nix +#+END_SRC + +*** nix-shell --pure + +- default.nix + +#+HEADER: :noweb yes +#+BEGIN_SRC sh +nix-shell --pure +nix-build -I nixpkgs=<<nixpkgs_local>> +nix-build -I .envrc +#+END_SRC + +#+BEGIN_SRC sh +nix build -f default.nix --print-build-logs +nix build -f derivation.nix --print-build-logs +nix shell -f default.nix --print-build-logs +# nix build -f project.nix +# nix build -f spine.nix +nix develop --build -f derivation.nix -I .envrc --print-build-logs +nix develop --profile .#default --print-build-logs --command spine -v +#+END_SRC + +*** derivation .drv + +#+BEGIN_SRC sh +nix show-derivation /nix/store/q7n14bm8j5vzm62qaraczdb4bpyf59vv-spine-0.11.1.drv +#+END_SRC + +**** .env/echo-nixNote CHECK MODIFY + +#+HEADER: :tangle ../.env/echo-nixNote +#+BEGIN_SRC sh +echo '-*- mode: org -*- + +,* nixpkgs path? + + # eval "$(nix print-dev-env)" +' > nixNote_.org + +echo " <nixpkgs> == `nix-instantiate --find-file nixpkgs`" >> nixNote_.org + +echo ' +,* nix build and show derivation + +,#+BEGIN_SRC sh +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 sh +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 sh +$SpineBIN/spine --very-verbose --pod --source --output="$SpineOUTversioned" $SpinePOD/* +,#+END_SRC + +,*** html & epub output + +,#+BEGIN_SRC sh +$SpineBIN/spine --very-verbose --html --epub --output="$SpineOUTversioned" $SpinePOD/* +,#+END_SRC + +,*** sqlite db for each document - populate each db + +,#+BEGIN_SRC sh +$SpineBIN/spine --very-verbose --sqlite-discrete --output="$SpineOUTversioned" $SpinePOD/* +,#+END_SRC + +,*** doc source; html, epub; sqlite outputs + +,#+BEGIN_SRC sh +$SpineBIN/spine --verbose --pod --html --epub --sqlite-discrete --output="$SpineOUTversioned" $SpinePOD/* +,#+END_SRC + +,*** curate (authors topics) + +,#+BEGIN_SRC sh +$SpineBIN/spine --very-verbose --curate --output="$SpineOUTversioned" $SpinePOD/* +,#+END_SRC + +,*** html, curate + +,#+BEGIN_SRC sh +$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 sh +$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 sh +$SpineBIN/spine --very-verbose --sqlite-db-create --output="$SpineOUTversioned" +,#+END_SRC + +,*** sqlite db (shared) - populate db + +,#+BEGIN_SRC sh +$SpineBIN/spine --very-verbose --sqlite-update --output="$SpineOUTversioned" $SpineDOC/spine-markup-samples/markup/pod/* +,#+END_SRC + +,*** sqlite db (shared) - drop db + +,#+BEGIN_SRC sh +$SpineBIN/spine --very-verbose --sqlite-db-drop --output="$SpineOUTversioned" +,#+END_SRC + +,*** sqlite db (shared) - create & populate db (single step) + +,#+BEGIN_SRC sh +$SpineBIN/spine --very-verbose --sqlite-db-create --sqlite-update --output="$SpineOUTversioned" $SpinePOD/* +,#+END_SRC + +,*** composite command: source pod, html, epub, curate, sqlite + +,#+BEGIN_SRC sh +$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 sh +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 sh +$SpineBIN/spine --very-verbose --sqlite-db-create --output="$SpineOUT" $SpinePOD/* + +$SpineBIN/spine -v --cgi-search-form-codegen --output=$SpineOUT $SpinePOD/* + +$SpineBIN/spine -v --show-config --config=$SpinePOD/.dr + +$SpineBIN/spine --html $SpinePOD/* + + +$SpineBIN/spine -v --cgi-search-form-codegen --config=$SpinePOD/.dr/config_local_site +,#+END_SRC + +,*** generate html linked to search form + +,#+BEGIN_SRC sh +$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 sh +$SpineBIN/spine -v --sqlite-db-create --sqlite-db-filename="<<spine_search_db>>" --sqlite-db-path="$SpineDBpath" +$SpineBIN/spine -v --sqlite-db-recreate --sqlite-db-filename="<<spine_search_db>>" --sqlite-db-path="$SpineDBpath" +,#+END_SRC + +,*** populate sqlite db + +,#+BEGIN_SRC sh +$SpineBIN/spine -v --sqlite-update --sqlite-db-filename="<<spine_search_db>>" --output=$SpineOUT $SpinePOD/* +,#+END_SRC + +,*** generate html (linked to search form), sql output, curate COMPOSITE + +,#+BEGIN_SRC sh +$SpineBIN/spine -v --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename="<<spine_search_db>>" --cgi-sqlite-search-filename="<<spine_search_cgi>>" --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 sh +$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: "<<spine_search_cgi>>" + cgi_action: "https://sisudoc.org/spine_search" + db_sqlite_filename: "<<spine_search_db>>" + db_sqlite_path: "/var/www/sqlite" +,#+END_SRC + +,*** make search form + +,#+BEGIN_SRC sh +$SpineBIN/spine -v --cgi-search-form-codegen --config=$SpinePOD/.dr/config_local_site +,#+END_SRC + +,*** latex + +,#+BEGIN_SRC sh +$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 + +*** makefile + +#+HEADER: :tangle ../makefile_ +#+BEGIN_SRC make +buildPhase: + HOME=$${PWD}; \ + for DC_ in dmd ldmd2 gdmd; do \ + echo "- check for D compiler $${DC_}"; \ + DC=$$(type -P $${DC_} || echo ""); \ + if [ ! "$${DC}" == "" ]; then \ + break; \ + fi; \ + done; \ + echo "D compiler = $${DC}"; \ + if [ "$${DC}" == "" ]; then \ + echo "Error: could not find D compiler"; \ + exit 1; \ + fi; \ + echo "$${DC_} used as D compiler to build $${pname}"; \ + export DFLAGS="-O2 -inline"; \ + dub build --compiler=$${DC} --build=release --combined --skip-registry=all; +checkPhase: + runHook preCheck; \ + HOME=$${PWD}; \ + dub test --combined --skip-registry=all; \ + runHook postCheck +installPhase: + runHook preInstall; \ + mkdir -p $${out}/bin; \ + install -m755 ./bin/spine $${out}/bin/spine; \ + runHook postInstall + #cp -r bin/spine $out/bin/. +postInstall: + echo "$${out}/share/cgi-bin"; \ + echo `ls -la $${out}/bin/spine` +#+END_SRC @@ -42,7 +42,7 @@ mkShell { # ### i18n translation related # perl534Packages.Po4a ### candy - starship + #starship ]; shellHook = '' #if [[ -f ".envrc" ]]; then @@ -72,7 +72,7 @@ mkShell { nix build .#default --print-build-logs |& nom - nix run - nix run .#spine --print-build-logs + nix run .#default --print-build-logs nix run default.nix --print-build-logs - nix shell @@ -89,7 +89,7 @@ mkShell { nix-instantiate | nix show-derivation | jq nix-build . --no-out-link | xargs -o nix-tree - nix-tree --derivation .#spine + nix-tree --derivation .#default " #echo "ldc `${pkgs.ldc}/bin/ldc2 -v`" diff --git a/test.nix b/test.nix new file mode 100644 index 0000000..bd1e469 --- /dev/null +++ b/test.nix @@ -0,0 +1,10 @@ +# This file was generated by https://github.com/lionello/dub2nix v0.3.0 + +{ pkgs ? import <nixpkgs> {} }: +with import ./mkDub.nix { inherit pkgs; }; + +mkDubDerivation { + src = ./.; + # version = "0.0.1"; + # buildInputs = [ add any runtime deps here ]; +} |