aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/config_nix.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/config_nix.org')
-rw-r--r--org/config_nix.org846
1 files changed, 846 insertions, 0 deletions
diff --git a/org/config_nix.org b/org/config_nix.org
new file mode 100644
index 0000000..4768bc3
--- /dev/null
+++ b/org/config_nix.org
@@ -0,0 +1,846 @@
+-*- mode: org -*-
+#+TITLE: configuration nix
+#+DESCRIPTION: makefile for spine
+#+FILETAGS: :spine:build:tools:
+#+AUTHOR: Ralph Amissah
+#+EMAIL: [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]]
+#+COPYRIGHT: Copyright (C) 2015 - 2022 Ralph Amissah
+#+LANGUAGE: en
+#+STARTUP: content hideblocks hidestars noindent entitiespretty
+#+PROPERTY: header-args :exports code
+#+PROPERTY: header-args+ :noweb yes
+#+PROPERTY: header-args+ :results no
+#+PROPERTY: header-args+ :cache no
+#+PROPERTY: header-args+ :padline no
+#+PROPERTY: header-args+ :mkdirp yes
+#+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t
+
+* nix :nix:
+
+#+NAME: nixpkgs_local
+#+BEGIN_SRC sh
+/srv/nixpkgs-dev/nixpkgs
+#+END_SRC
+
+** spine markup samples
+
+- default.nix
+- shell.nix
+
+*** envrc :envrc:
+**** .envrc
+
+- https://github.com/nix-community/nix-direnv
+ - source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-0000000000000000000000000000000000000000000="
+
+#+HEADER: :tangle ../.envrc
+#+BEGIN_SRC sh
+# nix_direnv_watch_file provided-filename
+use flake .
+NIX_ENFORCE_PURITY=1
+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-5EwyKnkJNQeXrRkYbwwRBcXbibosCJqyIUuz9Xq+LRc="
+fi
+if [ -f .envrc-local ]; then
+ source_env_if_exists .envrc-local || source .envrc-local
+fi
+#+END_SRC
+
+**** .envrc-local CHECK MODIFY
+
+- bespoke modify appropriately and generate if needed
+
+#+HEADER: :tangle ../.envrc-local_
+#+HEADER: :noweb yes
+#+BEGIN_SRC sh
+# 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
+#path_add PATH result/bin
+#export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos
+#export NIX_PATH=nixpkgs=/srv/nix/nixpkgs
+export DFLAGS="-O2 -inline -boundscheck=on -color=on"
+## load the flake devShell
+# eval "$(nix print-dev-env)"
+# echo $NIX_BUILD_TOP
+export Date=`date "+%Y%m%d"`
+export SpineDOC=.
+#export SpineSRC=
+export SpineBIN=result/bin
+#export SpineDOC=
+export SpinePOD=$SpineDOC/markup/pod
+export SpineOUT=/srv/www/spine
+export SpineDBpath=/srv/www/spine/sqlite
+#export SpineDBpath=/var/www/sqlite
+export SpineSearchActionLocal='http://localhost/spine_search'
+export SpineSearchActionRemote='https://sisudoc.org/spine_search'
+export SpineCGIform='spine_search'
+export SpineSQLdb='spine.search.db'
+#export PROG_VER_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
+echo "
+nix build -v .#default --print-build-logs
+nix run .#default --print-build-logs
+nix shell .#default --print-build-logs --command spine -v
+nix develop --build .#default --print-build-logs
+"
+#+END_SRC
+
+*** flake :flake:
+**** flake static :flake:static:
+***** flake.nix
+
+#+HEADER: :tangle ../flake.nix
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
+{
+ description = "a sisu like document parser search form";
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; # "github:nixos/nixpkgs";
+ flake-utils.url = "github:numtide/flake-utils";
+ spine.url = "<<spine_git_file_path_url>>";
+ spine.inputs.nixpkgs.follows = "nixpkgs";
+ spine.flake = true;
+ };
+ outputs = { self, nixpkgs, flake-utils, spine }:
+ 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 {
+ default = spine.packages.${system}.default;
+ #vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000=";
+ });
+ devShells = forAllSystems (system:
+ let pkgs = nixpkgsFor.${system};
+ in with pkgs; {
+ devShell = mkShell { buildInputs = [ git dub dmd ldc gdc sqlite ]; };
+ });
+ };
+}
+#+END_SRC
+
+***** flake single system
+
+#+HEADER: :tangle-NO ../flake-1_.nix
+#+BEGIN_SRC nix
+{
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+ inputs.flake-utils.url = "github:numtide/flake-utils";
+ inputs.spine.url = "git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine";
+ outputs = { nixpkgs, flake-utils, ... }:
+ flake-utils.lib.eachDefaultSystem (system:
+ let pkgs = import nixpkgs { inherit system; };
+ in with pkgs; {
+ devShell = mkShell { buildInputs = [ git dub dmd ldc sqlite ]; };
+ default = spine.packages.x86_64-linux.default;
+ });
+}
+#+END_SRC
+
+#+HEADER: :tangle-NO ../flake-2_.nix
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
+{
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+ inputs.flake-utils.url = "github:numtide/flake-utils";
+ inputs.spine.url = "git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine";
+ outputs = { nixpkgs, flake-utils, ... }:
+ flake-utils.lib.eachDefaultSystem (system:
+ with import nixpkgs { inherit system; }; {
+ devShell = mkShell { buildInputs = [ git dub dmd ldc sqlite ]; };
+ default = spine.packages.x86_64-linux.default;
+ });
+}
+#+END_SRC
+
+#+HEADER: :tangle-NO ../flake-3_.nix
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
+{
+ description = "a sisu like parser & document generator";
+ #version = "<<spine_version_set>>";
+ inputs.nixpkgs.url = "<<nixpkgs_url>>";
+ inputs.spine.url = "<<spine_git_file_path_url>>";
+ inputs.spine.flake = true;
+ inputs.spine-tarball.url = "<<spine_tarball_path_url>>";
+ inputs.spine-tarball.flake = true;
+ outputs = { <<flake_outputs>>, spine, spine-tarball }: {
+ <<flake_output_spine>>
+ <<flake_output_spine_tarball>>
+ <<flake_output_spine_markup_samples>>
+ <<flake_output_default>>
+ };
+}
+#+END_SRC
+
+*** flake :flake:
+**** notes?
+
+- flake.nix
+ /srv/nix/nixpkgs
+ ./shell.nix
+ - shell.nix
+ ./pkgs/shell-pkgs.nix
+ - pkgs/shell-pkgs.nix
+ - default.nix
+ ./nix/dub.selections.nix #
+ - dub.selections.nix
+
+- nix develop
+
+- nix flake update
+
+- nix shell -f default.nix --print-build-logs
+- nix shell -c default.nix
+
+- nix build `nix-instantiate`
+- nix build -f default.nix --print-build-logs
+- nix shell -f default.nix --print-build-logs
+- nix develop --build -f derivation.nix -I .envrc --print-build-logs
+
+- nix search --json 2>/dev/null |jq
+- nix flake show
+- nix show-derivation
+
+nix shell git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine --print-build-logs
+nix build "git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine" --print-build-logs
+nix develop 'git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine#default'
+nix flake clone git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine/
+
+# nix-instantiate | nix-build
+
+***** 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
+
+#+NAME: flake_inputs_spine
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
+spine.url = "git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine";
+spine.flake = true;
+#+END_SRC
+
+***** flake outputs
+****** flake outputs static
+
+#+NAME: flake_outputs
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
+self, nixpkgs, flake-utils
+#+END_SRC
+
+***** flake devshells
+
+#+NAME: flake_devshells
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
+devShells = forAllSystems (system:
+ let pkgs = nixpkgsFor.${system};
+ in {
+ default = pkgs.mkShell {
+ buildInputs = with pkgs; [ git dub dmd ldc sqlite ];
+ };
+});
+#+END_SRC
+
+***** flake 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 = spine.packages.x86_64-linux.default;
+#+END_SRC
+
+#+NAME: flake_output_spine_tarball
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
+packages.x86_64-linux.spine-tarball = spine-tarball.packages.x86_64-linux.default;
+#+END_SRC
+
+**** flake result/lib/spine-markup-samples
+
+#+NAME: flake_output_spine_markup_samples
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
+packages.x86_64-linux.spine-markup-samples =
+ let
+ pkgs = import nixpkgs {
+ system = "x86_64-linux";
+ };
+ in
+ pkgs.stdenv.mkDerivation {
+ pname = "spine-markup-samples";
+ version = "<<spine_version_set>>";
+ description = "markup samples for spine, a sisu like parser & document generator";
+ inherit self;
+ src = self;
+ shell = ./shell.nix;
+ buildPhase = ''
+ runHook preBuild
+ HOME="$PWD"
+ runHook postBuild
+ '';
+ checkPhase = ''
+ runHook preCheck
+ HOME="$PWD"
+ runHook postCheck
+ '';
+ installPhase = ''
+ runHook preInstall
+ mkdir -p $out/lib/spine-markup-samples
+ echo "pwd: $PWD"
+ cp -rv ./markup $out/lib/spine-markup-samples/.
+ runHook postInstall
+ '';
+ };
+#+END_SRC
+
+postInstall = ''
+ #${spine} -v
+ #echo "built:"
+ #$out/share/spine-markup-samples
+'';
+
+***** flake misc
+
+#+BEGIN_SRC nix
+inputs.spine.url = fetchTarball {
+ url = "<<spine_tarball_path_url>>";
+ sha256 = "<<spine_tarball_sha256>>";
+};
+#+END_SRC
+
+*** shell.nix :shell:
+**** tangle
+
+#+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
+{ pkgs ? import <nixpkgs> {} }:
+with pkgs;
+mkShell {
+ buildInputs = [
+ ### nix_related
+ # direnv
+ # nixVersions.unstable #nixFlakes
+ # nix-prefetch-git
+ # validatePkgConfig
+ # nix-tree jq nix-output-monitor
+ # git
+ # ps
+ ### d_build_related
+ ### package manager
+ # dub
+ ### compiler
+ # ldc
+ # 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
+ ];
+ shellHook = ''
+ #if [[ -f ".envrc" ]]; then
+ # source .envrc
+ #fi
+ #nix flake update
+ #echo ""
+ #echo "nix flake metadata:"
+ #nix flake metadata
+ #echo ""
+ #echo "nix flake check:"
+ #nix flake check
+ #echo ""
+ #echo "nix flake show:"
+ #nix flake show
+ echo "
+ nix flake update
+ nix flake metadata
+ nix flake check
+ nix flake show
+
+ nix build or nix develop? (suggestions):
+
+ - nix build
+ nix build .#default --print-build-logs
+ nix build .#default-tarball --print-build-logs
+ nix build .#default-markup-samples --print-build-logs
+ nix build --print-build-logs
+ nix build .#default --print-build-logs |& nom
+
+ - 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 --build .#default --print-build-logs
+ nix develop --build -f derivation.nix -I .envrc --print-build-logs
+ nix develop ; eval \$buildPhase
+
+ nix-build |& nom
+
+ spine -v
+
+ nix-instantiate | nix show-derivation | jq
+ nix-build . --no-out-link | xargs -o nix-tree
+ nix-tree --derivation .#default
+
+ "
+ '';
+}
+#+END_SRC
+
+#+BEGIN_SRC nix
+{ pkgs ? import <nixpkgs> {} }:
+with pkgs;
+mkShell {
+ buildInputs = [
+ # ### nix_related
+ # direnv
+ # nixVersions.unstable #nixFlakes
+ # nix-prefetch-git
+ # validatePkgConfig
+ # nix-tree jq nix-output-monitor
+ # git
+ # ps
+ # ### d_build_related
+ # ## package manager
+ # dub
+ # ## compiler
+ # ldc
+ # 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
+ ];
+ shellHook = ''
+ #if [[ -f ".envrc" ]]; then
+ # source .envrc
+ #fi
+ #nix flake update
+ #echo ""
+ #echo "nix flake metadata:"
+ #nix flake metadata
+ #echo ""
+ #echo "nix flake check:"
+ #nix flake check
+ #echo ""
+ #echo "nix flake show:"
+ #nix flake show
+ echo "
+ nix flake update
+ nix flake metadata
+ nix flake check
+ nix flake show
+
+ nix build or nix develop? (suggestions):
+
+ - nix build
+ nix build .#default --print-build-logs
+ nix build .#default-tarball --print-build-logs
+ nix build .#default-markup-samples --print-build-logs
+ nix build --print-build-logs
+ nix build .#default --print-build-logs |& nom
+
+ - nix run
+ nix run .#default --print-build-logs
+ nix run default.nix --print-build-logs
+
+ - nix shell
+ nix shell --print-build-logs --command spine -v
+
+ - nix develop
+ nix develop --build .#default --print-build-logs
+ nix develop --build -f derivation.nix -I .envrc --print-build-logs
+ nix develop ; eval \$buildPhase
+
+ nix-build |& nom
+
+ spine -v
+
+ nix-instantiate | nix show-derivation | jq
+ nix-build . --no-out-link | xargs -o nix-tree
+ nix-tree --derivation .#default
+
+ "
+ '';
+}
+#+END_SRC
+
+#+BEGIN_SRC text
+#% Notes
+
+# - shell.nix -I .envrc
+# - shell.nix -I .envrc --pure
+
+# [ 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 -p nixFlakes
+ # - nix-shell -p nixFlakes --pure
+ # - nix-shell -p nixFlakes --pure -p "with import /nixpkgs-ra/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 .envrc --pure
+ # - nix-build default.nix -I .envrc && result/bin/spine -v
+
+# [ nix-instantiate ]
+
+ # - nix-instantiate | nix show-derivation | jq
+ # - nix-instantiate -I .envrc | nix show-derivation -f derivation.nix -I .envrc | jq
+ # - nix-instantiate | nix show-derivation --recursive | jq
+ # - nix-instantiate -I .envrc | nix show-derivation -f derivation.nix --recursive -I .envrc | jq
+ # - nix-instantiate | nix-build
+ # - nix-instantiate -I .envrc | nix-build -I .envrc
+
+# [ nix shell ]
+
+ # - nix shell -c default.nix
+ # - nix shell -f default.nix --print-build-logs
+
+# [ nix build ]
+
+ # - nix build -I .envrc --print-build-logs
+ # - nix build -f default.nix --print-build-logs
+ # - nix build -f derivation.nix --print-build-logs
+
+ # - nix build `nix-instantiate`
+ # - nix build `nix-instantiate -I .envrc`
+
+ # - nix build -f default.nix && ./result/bin/spine -v && noti -t "spine build" -m "see ./result/bin/spine"
+
+# [ nix run ]
+
+ # - nix run default.nix --print-build-logs
+ # - nix run -I .envrc default.nix --print-build-logs
+
+# - 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-build
+# - nix build `nix-instantiate -I .envrc`
+
+# - nix develop --build -f default.nix -I .envrc
+
+# - nix-shell -I .envrc --pure
+# - nix-build default.nix -I .envrc && result/bin/spine -v
+
+# - nix shell -f default.nix --print-build-logs
+# - nix-instantiate -I .envrc | nix-build -I .envrc
+#+END_SRC
+
+*** default.nix :default:
+
+- default.nix -I nixpkgs=<provide local nix path>
+ e.g. default.nix -I nixpkgs=/nixpkgs-ra/nixpkgs
+
+- nix-build -I nixpkgs=<provide local nix path>
+ e.g. nix-build -I nixpkgs=<<nixpkgs_local>>
+
+#+HEADER: :noweb yes
+#+BEGIN_SRC sh
+nix-build -I nixpkgs=<<nixpkgs_local>>
+nix-build -I .envrc-local
+nix-build -I .envrc
+default.nix -I .envrc
+default.nix
+
+nix build -f default.nix --print-build-logs
+nix build -f derivation.nix --print-build-logs
+nix shell -f default.nix --print-build-logs
+nix develop --build -f derivation.nix -I .envrc --print-build-logs
+
+# nix build -f project.nix
+# nix build -f spine.nix
+#+END_SRC
+
+#+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 ./derivation.nix {}
+#+END_SRC
+
+*** derivation.nix :default:
+
+#+HEADER: :tangle ../derivation.nix
+#+HEADER: :tangle-mode (identity #o644)
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
+{ pkgs ? import <nixpkgs> {},
+ stdenv ? pkgs.stdenv,
+ lib ? pkgs.lib,
+ ldc ? null,
+ dcompiler ? pkgs.ldc,
+ dub ? pkgs.dub
+}:
+assert dcompiler != null;
+with (
+ with lib;
+ let
+ filterDub = name: type: let baseName = baseNameOf (toString name); in ! ( # filter function to remove the .dub package folder from src
+ type == "directory" && baseName == ".dub"
+ );
+ targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}";
+ # remove reference to build tools and library sources
+ disallowedReferences = deps: [ dcompiler dub ];
+ removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}'';
+ in {
+ mkDubDerivation = lib.makeOverridable ({
+ src,
+ nativeBuildInputs ? [],
+ dubJSON ? src + "/dub.json",
+ passthru ? {},
+ package ? lib.importJSON dubJSON,
+ ...
+ } @ attrs: stdenv.mkDerivation (attrs // {
+ pname = package.name;
+ nativeBuildInputs = [ dcompiler dub pkgs.removeReferencesTo ] ++ nativeBuildInputs;
+ disallowedReferences = disallowedReferences deps;
+ passthru = passthru // {
+ inherit dub dcompiler pkgs;
+ };
+ src = lib.cleanSourceWith {
+ filter = filterDub;
+ src = lib.cleanSource src;
+ };
+ preFixup = ''
+ find $out/bin -type f -exec ${removeExpr (disallowedReferences deps)} '{}' + || true
+ '';
+ buildPhase = ''
+ runHook preBuild
+ HOME="$PWD"
+ 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
+ cp -r "${targetOf package}" $out/bin
+ #cp -rv "${targetOf package}" $out/spine-markup-samples/.
+ #cp -rv ./markup $out/spine-markup-samples/.
+ runHook postInstall
+ '';
+ #postInstall= ''
+ # cp -rv ./markup $out/spine-markup-samples/.
+ #'';
+ meta = lib.optionalAttrs (package ? description) {
+ description = package.description;
+ } // attrs.meta or {};
+ } // lib.optionalAttrs (!(attrs ? version)) {
+ name = package.name; # use name from dub.json, unless pname and version are specified
+ }));
+ }
+);
+mkDubDerivation rec {
+ pname = "spine";
+ version = "0.12.0";
+ zipfile = "<<spine_tarball_filename>>";
+ src = fetchTarball {
+ #url = "file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/tarball/${pname}-${version}.tar.gz";
+ #url = "file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine/tarballGitHEAD/${pname}-${version}.tar.gz";
+ #sha256 = "sha256:0000000000000000000000000000000000000000000000000000";
+ url = "<<spine_tarball_path_url>>";
+ sha256 = "<<spine_tarball_sha256>>";
+ };
+ nativeBuildInputs = with pkgs; [ dub ldc ];
+ buildInputs = with pkgs; [
+ nixVersions.unstable #nixFlakes
+ sqlite
+ ];
+ meta = with pkgs.lib; {
+ description = "A sisu like parser & document generator";
+ longDescription = ''
+ A sisu like parser & document generator
+ '';
+ homepage = "https://sisudoc.org";
+ license = licenses.agpl3Plus;
+ platforms = platforms.linux;
+ maintainers = [ "RalphAmissah" ];
+ };
+}
+#+END_SRC
+
+# src = fetchTarball {
+# url = "file:///[path]/${pname}-${version}.tar.gz";
+# sha256 = "sha256:0000000000000000000000000000000000000000000000000000";
+# };
+
+#src = ./.;
+
+** variables
+*** spine version SET VERSION :version:set:project:
+
+#+NAME: spine_version_set
+#+BEGIN_SRC sh
+0.12.0
+#+END_SRC
+
+#+NAME: project_path_local_out_static
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
+/srv/www/spine
+#+END_SRC
+
+#+NAME: spine_tarball_path
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
+/home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/tarball
+#+END_SRC
+
+#+NAME: spine_tarball_path_url
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
+file://<<spine_tarball_path>>/<<spine_tarball_filename>>
+#+END_SRC
+
+#+NAME: spine_git_file_path
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
+/home/ralph/grotto/repo/git.repo/projects/doc-reform/code/software/spine
+#+END_SRC
+
+#+NAME: spine_git_file_path_url
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
+git+file://<<spine_git_file_path>>
+#+END_SRC
+
+#+NAME: spine_tarball_filename
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
+spine-0.12.0-tag-0.11.2.r107.gf89a107.tar.gz
+#+END_SRC
+
+#+NAME: spine_tarball_sha256
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
+sha256:03dr7dn7kq6arw4ry7qar13iqmi1caw70imfjwi8qr7g2j4mnk2q
+#+END_SRC
+
+#+BEGIN_SRC nix
+sha256:0000000000000000000000000000000000000000000000000000
+#+END_SRC
+
+/home/ralph/grotto/repo/git.repo/projects/project-spine/tarball
+
+#+NAME: project_path_local_out_static_
+#+BEGIN_SRC nix
+/var/www
+#+END_SRC
+
+#+NAME: project_path_sqlite
+#+BEGIN_SRC nix
+/var/www/sqlite
+#+END_SRC
+
+#+NAME: nixpkgs_url
+#+BEGIN_SRC nix
+github:nixos/nixpkgs
+#+END_SRC
+
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
+<<nixpkgs_path_local>>
+#+END_SRC
+