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.org275
1 files changed, 194 insertions, 81 deletions
diff --git a/org/config_nix.org b/org/config_nix.org
index c036a14..1953533 100644
--- a/org/config_nix.org
+++ b/org/config_nix.org
@@ -38,37 +38,42 @@
use flake .
#use flake .#default
NIX_ENFORCE_PURITY=1
-NixDirEnvVersion="2.2.0"
+NixDirEnvVersion="2.2.1"
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="
+ source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi
watch_file flake.lock
watch_file flake.nix
-nix flake update && nix flake check --show-trace && nix flake show
if [ -f .envrc-local ]; then
source_env_if_exists .envrc-local || source .envrc-local
fi
-echo "
-
-- nix flake update && nix flake check --show-trace && nix flake show && nix develop .#devShell
-
-- nix build .#default --print-build-logs
-- nix build .#spine-dmd --print-build-logs
-- nix build .#spine-ldc --print-build-logs
-- nix build .#spine-gdc --print-build-logs
-
-nix-shell '<nixpkgs>' -A nix --pure
-
-nix run .#default --print-build-logs
-
-nix develop --build .#default --print-build-logs
-
-nix shell .#default --print-build-logs --command spine -v
-nix shell .#default --print-build-logs --command spine --very-verbose --epub --html --html-link-search --html-link-curate --curate --output=\"\$SpineOUT\" ./markup/pod
-nix shell .#default --print-build-logs --command spine --very-verbose --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename=\"spine.search.db\" --cgi-sqlite-search-filename=\"spine_search\" --sqlite-db-path=\"\$SpineDBpath\" --output=\"\$SpineOUT\" ./markup/pod
-"
+PATH_add result/bin
+#nix flake update && nix flake check --show-trace && nix flake show
+# echo "
+#
+# - nix flake update && nix flake check --show-trace && nix flake show && nix develop .#devShell
+#
+# - nix build .#default --print-build-logs
+# - nix build .#spine-dmd --print-build-logs
+# - nix build .#spine-ldc --print-build-logs
+# - nix build .#spine-gdc --print-build-logs
+#
+# - nix develop
+# - nix develop .#devShell --print-build-logs
+# - nix develop .#devShell-html --print-build-logs
+# - nix develop .#devShell-epub --print-build-logs
+# - nix develop .#devShell-latex-pdf --print-build-logs
+# - nix develop .#devShell-sqlite --print-build-logs
+# - nix develop .#devShell-i18n --print-build-logs
+#
+# nix run .#default --print-build-logs
+#
+# nix develop --build .#default --print-build-logs
+#
+# nix-shell '<nixpkgs>' -A nix --pure
+# "
#+END_SRC
**** .envrc-local CHECK MODIFY
@@ -78,31 +83,23 @@ nix shell .#default --print-build-logs --command spine --very-verbose --html --h
#+HEADER: :tangle ../.envrc-local_
#+HEADER: :noweb yes
#+BEGIN_SRC sh
-PATH_add result/bin
-export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos
+#export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos
#export NIX_PATH=/srv/nix/nixpkgs
#export NIX_PATH=nixpkgs=/srv/nix/nixpkgs
export DFLAGS="-O2 -inline -boundscheck=on -color=on"
-## 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 SpineBIN=result/bin
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
-export SpinePOD=$SpineDOC/markup/pod
-export SpineOUTversioned=/srv/www/spine/$SpineVER
export SpineOUT=/srv/www/spine
+export SpineOUTversioned=/srv/www/spine/$SpineVER
export SpineDBpath=/var/www/sqlite
#export SpineDBpath=/srv/www/spine/sqlite
+export SpineCGIbin=/var/www/cgi/cgi-bin
export SpineSearchActionLocal='http://localhost/spine_search'
export SpineSearchActionRemote='https://sisudoc.org/spine_search'
export SpineCGIform='spine_search'
export SpineSQLdb='spine.search.db'
-export PROG_VER_GIT="`git describe --long --tags | sed -e 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g'`"
-export 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'`"
#+END_SRC
*** flake :flake:
@@ -116,16 +113,30 @@ export PROG_VER_DECLARED="`cat ./views/version.txt | grep --color=never "enum" |
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 }:
+ outputs = { self, nixpkgs, flake-utils } @inputs:
let
pname = "spine";
version = "<<spine_version_set>>";
shell = ./shell.nix; # ./default.nix;
- devEnv = ./shell.nix; # ./default.nix;
+ devEnv = ./.envrc; # ./shell.nix; # ./default.nix;
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.
- <<flake_phases_other_than_build>>
+ checkPhase = ''
+ runHook preCheck
+ dub test --combined --skip-registry=all
+ runHook postCheck
+ '';
+ installPhase = ''
+ runHook preInstall
+ mkdir -p $out/bin
+ install -m755 ./bin/spine $out/bin/spine
+ runHook postInstall
+ '';
+ postInstall = ''
+ echo `ls -la $out/bin/spine`
+ $out/bin/spine -v
+ '';
in {
packages = forAllSystems (system:
let pkgs = nixpkgsFor.${system};
@@ -214,7 +225,7 @@ export PROG_VER_DECLARED="`cat ./views/version.txt | grep --color=never "enum" |
inherit postInstall;
};
#vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000=";
- });
+ });
apps = forAllSystems (system: {
default = {
type = "app";
@@ -222,10 +233,120 @@ export PROG_VER_DECLARED="`cat ./views/version.txt | grep --color=never "enum" |
};
});
devShells = forAllSystems (system:
- let pkgs = nixpkgsFor.${system};
+ let
+ pkgs = nixpkgsFor.${system};
+ shellHook = ''
+ export DFLAGS="-O2 -inline -boundscheck=on -color=on"
+ export Date=`date "+%Y%m%d"`
+ export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g')
+ ### set local values in .envrc-local (or modify here if you must)
+ # export SpinePROJ=~/grotto/repo/git.repo/projects/doc-reform/code/software/spine
+ # export SpineDOC=~/grotto/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples
+ # export SpineOUT=/srv/www/spine
+ # export SpineDBpath=/var/www/sqlite
+ # export SpineDBpath=/srv/www/spine/sqlite
+ export SpineSRC=$SpinePROJ/src
+ export SpineBIN=$SpinePROJ/result/bin
+ export SpinePOD=$SpineDOC/markup/pod
+ export SpineOUTversioned=$SpineOUT/$SpineVER
+ export SpineSearchActionLocal='http://localhost/spine_search'
+ # export SpineSearchActionRemote='https://sisudoc.org/spine_search'
+ export SpineCGIform='spine_search'
+ export SpineSQLdb='spine.search.db'
+ export PROG_VER_GIT="`git describe --long --tags | sed -e 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g'`"
+ export 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'`"
+ export spineNixHelp="cat ./.env/nix-commands"
+ export spineTest="nix shell .#default --print-build-logs --command spine --very-verbose --epub --html --html-link-search --html-link-curate --curate --output=\"\$SpineOUT\" $SpinePOD/*"
+ export spineHtml="spine --very-verbose --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename=\"spine.search.db\" --cgi-sqlite-search-filename=\"spine_search\" --sqlite-db-path=\"\$SpineDBpath\" --output=\"\$SpineOUT\" $SpinePOD/*"
+ export spineEpub="spine --very-verbose --epub --output=\"\$SpineOUT\" $SpinePOD/*"
+ export spineLatex="spine --very-verbose --latex --output=\"\$SpineOUT\" $SpinePOD/*"
+ export spinePdf="spine --very-verbose --pdf --output=\"\$SpineOUT\" $SpinePOD/*"
+ export spineSqliteCreateDB="spine --very-verbose --sqlite-db-recreate --sqlite-db-path=\"$SpineDBpath\" --sqlite-db-filename=\"spine.search.db\""
+ export spineSqlite="spine --very-verbose --sqlite-discrete --sqlite-db-path=\"$SpineDBpath\" --sqlite-db-filename=\"spine.search.db\" --output=\"\$SpineOUT\" $SpinePOD/*"
+ #export spineSqlite="spine --very-verbose --sqlite-update --sqlite-db-path=\"$SpineDBpath\" --sqlite-db-filename=\"spine.search.db\" --output=\"\$SpineOUT\" $SpinePOD/*"
+ '';
in with pkgs; {
- devShell = mkShell { };
- });
+ devShell = mkShell rec {
+ name = "spine dev shell default";
+ inherit shell;
+ inherit devEnv;
+ #buildInputs = [ sqlite ];
+ #nativeBuildInputs = [ dub dmd ldc gdc gnumake ];
+ packages = [
+ sqlite
+ dub dmd ldc gdc gnumake
+ ];
+ inherit shellHook;
+ };
+ devShell-epub = mkShell rec {
+ name = "spine dev shell for epub output";
+ inherit shell;
+ inherit devEnv;
+ packages = [
+ dub dmd ldc gdc gnumake
+ sqlite
+ libxml2
+ html-tidy
+ xmlstarlet
+ epubcheck
+ ebook_tools
+ libxml2
+ html-tidy
+ xmlstarlet
+ epubcheck
+ ebook_tools
+ epr
+ sigil
+ calibre #(suite includes: ebook-viewer)
+ foliate
+ ];
+ inherit shellHook;
+ };
+ devShell-html = mkShell rec {
+ name = "spine dev shell for latex & pdf output";
+ inherit shell;
+ inherit devEnv;
+ packages = [
+ dub dmd ldc gdc gnumake
+ sqlite
+ ];
+ inherit shellHook;
+ };
+ devShell-latex-pdf = mkShell rec {
+ name = "spine dev shell for latex & pdf output";
+ inherit shell;
+ inherit devEnv;
+ packages = [
+ dub dmd ldc gdc gnumake
+ sqlite
+ source-sans-pro
+ source-serif-pro
+ source-code-pro
+ texlive.combined.scheme-full
+ ];
+ inherit shellHook;
+ };
+ devShell-sqlite = mkShell rec {
+ name = "spine dev shell for latex & pdf output";
+ inherit shell;
+ inherit devEnv;
+ packages = [
+ dub dmd ldc gdc gnumake
+ sqlite
+ ];
+ inherit shellHook;
+ };
+ devShell-i18n = mkShell {
+ inherit shell;
+ inherit devEnv;
+ packages = [
+ dub dmd ldc gdc gnumake
+ sqlite
+ perl534Packages.Po4a
+ ];
+ inherit shellHook;
+ };
+ });
};
}
#+END_SRC
@@ -359,10 +480,10 @@ buildPhase = ''
dub build --compiler=$DC --build=$DC_ --combined --skip-registry=all
runHook postBuild
'';
-<<flake_phases_other_than_build>>
+<<flake_phases_other_than_buildPhase>>
#+END_SRC
-#+NAME: flake_phases_other_than_build
+#+NAME: flake_phases_other_than_buildPhase
#+HEADER: :noweb yes
#+BEGIN_SRC nix
checkPhase = ''
@@ -401,36 +522,6 @@ postInstall = ''
'';
#+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
@@ -577,12 +668,12 @@ mkShell {
#meson
### sqlite search related
sqlite
- # ### pdf_latex_related
+ ### pdf_latex_related
# source-sans-pro
# source-serif-pro
# source-code-pro
# texlive.combined.scheme-full
- # ### xml_and_epub_related
+ ### xml_and_epub_related
# libxml2
# html-tidy
# xmlstarlet
@@ -592,10 +683,8 @@ mkShell {
# sigil
# calibre #(suite includes: ebook-viewer)
# foliate
- # ### i18n translation related
+ ### i18n translation related
# perl534Packages.Po4a
- ### candy
- #starship
];
shellHook = ''
#if [[ -f ".envrc" ]]; then
@@ -632,7 +721,7 @@ mkShell {
nix shell --print-build-logs --command spine -v
- nix develop
- nix develop --build .#default --print-build-logs
+ nix develop --build .#default --print-build-logs
nix develop --build -f derivation.nix -I .envrc --print-build-logs
nix develop ; eval \$buildPhase
@@ -1069,9 +1158,9 @@ mkDubDerivation rec {
nativeBuildInputs = with pkgs; [ dub ldc ];
buildInputs = with pkgs; [ nixVersions.unstable sqlite ];
meta = with pkgs.lib; {
- description = "A sisu like parser and document generator";
+ description = "A sisu like parser & document generator";
longDescription = ''
- a sisu like parser and document generator
+ a sisu like parser & document generator
'';
homepage = "https://sisudoc.org";
license = licenses.agpl3Plus;
@@ -1451,6 +1540,30 @@ nix show-derivation /nix/store/q7n14bm8j5vzm62qaraczdb4bpyf59vv-spine-0.11.1.drv
**** .env/echo-nixNote CHECK MODIFY
+#+HEADER: :tangle ../.env/nix-commands
+#+BEGIN_SRC text
+- nix flake update && nix flake check --show-trace && nix flake show && nix develop .#devShell
+
+- nix build .#default --print-build-logs
+- nix build .#spine-dmd --print-build-logs
+- nix build .#spine-ldc --print-build-logs
+- nix build .#spine-gdc --print-build-logs
+
+- nix develop
+ - nix develop .#devShell --print-build-logs
+ - nix develop .#devShell-html --print-build-logs
+ - nix develop .#devShell-epub --print-build-logs
+ - nix develop .#devShell-latex-pdf --print-build-logs
+ - nix develop .#devShell-sqlite --print-build-logs
+ - nix develop .#devShell-i18n --print-build-logs
+
+nix run .#default --print-build-logs
+
+nix develop --build .#default --print-build-logs
+
+nix-shell '<nixpkgs>' -A nix --pure
+#+END_SRC
+
#+HEADER: :tangle ../.env/echo-nixNote
#+BEGIN_SRC sh
echo '-*- mode: org -*-