From badd5fe16d04828bdd6d38b9ec3f237555760e0c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 10 Jun 2023 23:01:53 -0400 Subject: nix configure --- .env/echo-nixNote | 2 +- .envrc-nix | 11 ++++++- .gitattributes | 5 +++ flake.nix | 67 ++++++++++++++++++++++++++--------------- makefile | 28 ++++++++++------- org/COPYRIGHT | 6 ++-- org/config_env.org | 11 ++++++- org/config_git.org | 5 +++ org/config_make.org | 28 ++++++++++------- org/config_nix.org | 87 +++++++++++++++++++++++++++-------------------------- shell.nix | 16 ---------- 11 files changed, 155 insertions(+), 111 deletions(-) diff --git a/.env/echo-nixNote b/.env/echo-nixNote index ad8717f..b746c43 100644 --- a/.env/echo-nixNote +++ b/.env/echo-nixNote @@ -207,7 +207,7 @@ webserv: data_root_url: "https://sisudoc.org" data_root_path: "/srv/www/spine" images_root_part: "image" - cgi_search_form_title: "≅ SiSU Spine search" + cgi_search_form_title: "≅ SiSU Spine search ፨" cgi_http: "https" cgi_domain: "sisudoc.org" cgi_bin_url: "http://sisudoc.org/cgi-bin" diff --git a/.envrc-nix b/.envrc-nix index 579e33c..abbed16 100644 --- a/.envrc-nix +++ b/.envrc-nix @@ -1,4 +1,5 @@ NIX_ENFORCE_PURITY=1 +# - https://github.com/nix-community/nix-direnv NixDirEnvVersion="2.3.0" NixDirEnvSHA="sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8=" if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then @@ -6,12 +7,20 @@ if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then fi watch_file flake.lock watch_file flake.nix +watch_file shell.nix watch_file makefile +watch_file .envrc watch_file .envrc-local watch_file .envrc-nix -PATH_add result/bin +nix_direnv_watch_file flake.nix +nix_direnv_watch_file shell.nix +nix_direnv_watch_file .envrc +nix_direnv_watch_file .envrc-local +nix_direnv_watch_file .envrc-nix nix flake update nix flake check nix flake show +echo "" +PATH_add result/bin use flake . #use flake .#default diff --git a/.gitattributes b/.gitattributes index a16ee24..b160f54 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,6 +2,11 @@ /subprojects export-ignore /build export-ignore .gitattributes export-ignore +/.dub export-ignore +/.direnv export-ignore +/*_ export-ignore +*_ export-ignore #.gitignore export-ignore tangle export-ignore flake.lock export-ignore +/build export-ignore diff --git a/flake.nix b/flake.nix index 4f487f0..0ac58cf 100644 --- a/flake.nix +++ b/flake.nix @@ -73,7 +73,7 @@ inherit installPhase; inherit postInstall; }; - spine-dmd = stdenv.mkDerivation { + spine-overlay-dmd = stdenv.mkDerivation { inherit pname; inherit version; meta.mainProgram = "spine-dmd"; @@ -92,7 +92,7 @@ inherit installPhase; inherit postInstall; }; - spine-ldc = stdenv.mkDerivation { + spine-overlay-ldc = stdenv.mkDerivation { inherit pname; inherit version; meta.mainProgram = "spine-ldc"; @@ -111,7 +111,26 @@ inherit installPhase; inherit postInstall; }; - #spine-gdc = stdenv.mkDerivation { + spine-nixpkgs-ldc = stdenv.mkDerivation { + inherit pname; + inherit version; + meta.mainProgram = "spine-ldc"; + executable = true; + src = self; + inherit shell; + inherit devEnv; + buildInputs = with pkgs; [sqlite]; + nativeBuildInputs = with pkgs; [dub ldc gnumake]; + buildPhase = '' + runHook preBuild + dub build --cache=local --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all + runHook postBuild + ''; + inherit checkPhase; + inherit installPhase; + inherit postInstall; + }; + #spine-overlay-gdc = stdenv.mkDerivation { # inherit pname; # inherit version; # meta.mainProgram = "spine-gdc"; @@ -147,57 +166,57 @@ ''; in with pkgs-ovl; { - devShell = mkShell { + dsh-overlay = mkShell { name = "spine base dev shell"; inherit shell; inherit devEnv; #buildInputs = [ sqlite ]; #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ - sqlite ldc #dmd dub gnumake + sqlite ]; inherit shellHook; }; - devShell-dmd = mkShell { + dsh-overlay-dmd-dub = mkShell { name = "spine base dev shell"; inherit shell; inherit devEnv; #buildInputs = [ sqlite ]; #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ - sqlite dmd dub gnumake + sqlite ]; inherit shellHook; }; - devShell-ldc = mkShell { + dsh-overlay-ldc-dub = mkShell { name = "spine base dev shell"; inherit shell; inherit devEnv; #buildInputs = [ sqlite ]; #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ - sqlite ldc dub gnumake + sqlite ]; inherit shellHook; }; - devShell-epub = mkShell { + dsh-epub = mkShell { name = "spine dev shell for epub output"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite libxml2 @@ -217,27 +236,27 @@ ]; inherit shellHook; }; - devShell-html = mkShell { + dsh-html = mkShell { name = "spine dev shell for latex & pdf output"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite ]; inherit shellHook; }; - devShell-latex-pdf = mkShell { + dsh-latex-pdf = mkShell { name = "spine dev shell for latex & pdf output"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite source-sans-pro @@ -247,27 +266,27 @@ ]; inherit shellHook; }; - devShell-sqlite = mkShell { + dsh-sqlite = mkShell { name = "spine dev shell for latex & pdf output"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite ]; inherit shellHook; }; - devShell-i18n = mkShell { + dsh-i18n = mkShell { name = "spine dev shell internationalization, po4a"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite perl534Packages.Po4a diff --git a/makefile b/makefile index 3cbdc77..ac0d8c9 100644 --- a/makefile +++ b/makefile @@ -438,7 +438,11 @@ changelog_: changelog: git log --pretty=format:'---%+s %+as %ae%+h%d%+b' --no-merges | sed "/^\\s*$$/d" | sed "s/^---$$//" | sed "s/^\(\*\)\+/-/" | sed "s/ \+$$//" | sed "s/ \+$//" > CHANGELOG_ +# git archive gitZip: + if [ ! -d "./tarballGitHEAD" ]; then \ + mkdir ./tarballGitHEAD; \ + fi; \ git archive -v --format=tar --prefix=`echo spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT)`/ HEAD | gzip > ./tarballGitHEAD/spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT).tar.gz && \ echo "to unzip: tar -xzf spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT).tar.gz" @@ -486,11 +490,13 @@ get_depends: echo $${hwd} && \ echo $${gwd} && \ dub upgrade; \ - if [ ! -d $${gwd} ]; then \ - mkdir -p $${gwd}/{d2sqlite3,D-YAML,imageformats,tinyendian}; \ - fi; \ + deps=`echo "d2sqlite3 D-YAML imageformats tinyendian"` && \ + for dir in $${deps}; do \ + if [ ! -d $${gwd}/$${dir} ]; then \ + mkdir -p $${gwd}/$${dir}; \ + fi; \ + done; \ cd $${gwd} && \ - deps=`ls -gx '.'` && \ for dir in $${deps}; do \ if [ -d $${dir} ]; then \ echo $${dir} && \ @@ -499,10 +505,10 @@ get_depends: rm -rf $${dir} && \ git clone --depth=1 https://github.com/tjhann/$${dir} && \ cd $${dir} && \ - echo $$PWD && \ - echo "$${dir} `git rev-parse HEAD | cut -c 1-8`" > ../$${dir}.meta && \ - echo "https://github.com/tjhann/$${dir}" >> ../$${dir}.meta && \ - echo "$${license_bsl}" >> ../$${dir}.meta && \ + echo $$PWD && \ + echo "$${dir} `git rev-parse HEAD | cut -c 1-8`" > ../$${dir}.meta && \ + echo "https://github.com/tjhann/$${dir}" >> ../$${dir}.meta && \ + echo "$${license_bsl}" >> ../$${dir}.meta && \ cd $${gwd} && \ rm -rf $${dir}/.git; \ elif [[ "d2sqlite3" == $${dir} || "D-YAML" == $${dir} || "tinyendian" == $${dir} ]]; then \ @@ -510,9 +516,9 @@ get_depends: rm -rf $${dir} && \ git clone --depth=1 https://github.com/dlang-community/$${dir} && \ cd $${dir} && \ - echo "$${dir} `git rev-parse HEAD | cut -c 1-8`" > ../$${dir}.meta && \ - echo "https://github.com/dlang-community/$${dir}" >> ../$${dir}.meta && \ - echo "$${license_bsl}" >> ../$${dir}.meta && \ + echo "$${dir} `git rev-parse HEAD | cut -c 1-8`" > ../$${dir}.meta && \ + echo "https://github.com/dlang-community/$${dir}" >> ../$${dir}.meta && \ + echo "$${license_bsl}" >> ../$${dir}.meta && \ cd $${gwd} && \ rm -rf $${dir}/.git; \ fi; \ diff --git a/org/COPYRIGHT b/org/COPYRIGHT index 53834a0..4480c58 100644 --- a/org/COPYRIGHT +++ b/org/COPYRIGHT @@ -1,10 +1,10 @@ - Name: spine - SiSU Spine, Doc Reform - Description: documents, structuring, processing, publishing, search - static content generator - + - Author: Ralph Amissah [ralph.amissah@gmail.com] - + - Copyright: (C) 2015 - 2023 Ralph Amissah - Spine, Doc Reform (related to SiSU) uses standard: @@ -13,7 +13,7 @@ modifications - docReform object numbering (based on SiSU object citation numbering) - standard SiSU document object numbering - + - Homepages: [https://www.sisudoc.org] diff --git a/org/config_env.org b/org/config_env.org index 2f8a111..c9f9407 100644 --- a/org/config_env.org +++ b/org/config_env.org @@ -40,6 +40,7 @@ fi #+HEADER: :tangle ../.envrc-nix #+BEGIN_SRC sh NIX_ENFORCE_PURITY=1 +# - https://github.com/nix-community/nix-direnv NixDirEnvVersion="<>" NixDirEnvSHA="<>" if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then @@ -47,13 +48,21 @@ if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then fi watch_file flake.lock watch_file flake.nix +watch_file shell.nix watch_file makefile +watch_file .envrc watch_file .envrc-local watch_file .envrc-nix -PATH_add result/bin +nix_direnv_watch_file flake.nix +nix_direnv_watch_file shell.nix +nix_direnv_watch_file .envrc +nix_direnv_watch_file .envrc-local +nix_direnv_watch_file .envrc-nix nix flake update nix flake check nix flake show +echo "" +PATH_add result/bin use flake . #use flake .#default #+END_SRC diff --git a/org/config_git.org b/org/config_git.org index 89db936..671f42e 100644 --- a/org/config_git.org +++ b/org/config_git.org @@ -119,7 +119,12 @@ tmp/** /subprojects export-ignore /build export-ignore .gitattributes export-ignore +/.dub export-ignore +/.direnv export-ignore +/*_ export-ignore +,*_ export-ignore #.gitignore export-ignore tangle export-ignore flake.lock export-ignore +/build export-ignore #+END_SRC diff --git a/org/config_make.org b/org/config_make.org index ccf2614..58f58fb 100644 --- a/org/config_make.org +++ b/org/config_make.org @@ -488,7 +488,11 @@ changelog_: changelog: git log --pretty=format:'---%+s %+as %ae%+h%d%+b' --no-merges | sed "/^\\s*$$/d" | sed "s/^---$$//" | sed "s/^\(\*\)\+/-/" | sed "s/ \+$$//" | sed "s/ \+$//" > CHANGELOG_ +# git archive gitZip: + if [ ! -d "./tarballGitHEAD" ]; then \ + mkdir ./tarballGitHEAD; \ + fi; \ git archive -v --format=tar --prefix=`echo spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT)`/ HEAD | gzip > ./tarballGitHEAD/spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT).tar.gz && \ echo "to unzip: tar -xzf spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT).tar.gz" @@ -536,11 +540,13 @@ get_depends: echo $${hwd} && \ echo $${gwd} && \ dub upgrade; \ - if [ ! -d $${gwd} ]; then \ - mkdir -p $${gwd}/{d2sqlite3,D-YAML,imageformats,tinyendian}; \ - fi; \ + deps=`echo "d2sqlite3 D-YAML imageformats tinyendian"` && \ + for dir in $${deps}; do \ + if [ ! -d $${gwd}/$${dir} ]; then \ + mkdir -p $${gwd}/$${dir}; \ + fi; \ + done; \ cd $${gwd} && \ - deps=`ls -gx '.'` && \ for dir in $${deps}; do \ if [ -d $${dir} ]; then \ echo $${dir} && \ @@ -549,10 +555,10 @@ get_depends: rm -rf $${dir} && \ git clone --depth=1 https://github.com/tjhann/$${dir} && \ cd $${dir} && \ - echo $$PWD && \ - echo "$${dir} `git rev-parse HEAD | cut -c 1-8`" > ../$${dir}.meta && \ - echo "https://github.com/tjhann/$${dir}" >> ../$${dir}.meta && \ - echo "$${license_bsl}" >> ../$${dir}.meta && \ + echo $$PWD && \ + echo "$${dir} `git rev-parse HEAD | cut -c 1-8`" > ../$${dir}.meta && \ + echo "https://github.com/tjhann/$${dir}" >> ../$${dir}.meta && \ + echo "$${license_bsl}" >> ../$${dir}.meta && \ cd $${gwd} && \ rm -rf $${dir}/.git; \ elif [[ "d2sqlite3" == $${dir} || "D-YAML" == $${dir} || "tinyendian" == $${dir} ]]; then \ @@ -560,9 +566,9 @@ get_depends: rm -rf $${dir} && \ git clone --depth=1 https://github.com/dlang-community/$${dir} && \ cd $${dir} && \ - echo "$${dir} `git rev-parse HEAD | cut -c 1-8`" > ../$${dir}.meta && \ - echo "https://github.com/dlang-community/$${dir}" >> ../$${dir}.meta && \ - echo "$${license_bsl}" >> ../$${dir}.meta && \ + echo "$${dir} `git rev-parse HEAD | cut -c 1-8`" > ../$${dir}.meta && \ + echo "https://github.com/dlang-community/$${dir}" >> ../$${dir}.meta && \ + echo "$${license_bsl}" >> ../$${dir}.meta && \ cd $${gwd} && \ rm -rf $${dir}/.git; \ fi; \ diff --git a/org/config_nix.org b/org/config_nix.org index ee9b157..41efed4 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -96,7 +96,7 @@ inherit installPhase; inherit postInstall; }; - spine-dmd = stdenv.mkDerivation { + spine-overlay-dmd = stdenv.mkDerivation { inherit pname; inherit version; meta.mainProgram = "spine-dmd"; @@ -115,7 +115,7 @@ inherit installPhase; inherit postInstall; }; - spine-ldc = stdenv.mkDerivation { + spine-overlay-ldc = stdenv.mkDerivation { inherit pname; inherit version; meta.mainProgram = "spine-ldc"; @@ -134,7 +134,26 @@ inherit installPhase; inherit postInstall; }; - #spine-gdc = stdenv.mkDerivation { + spine-nixpkgs-ldc = stdenv.mkDerivation { + inherit pname; + inherit version; + meta.mainProgram = "spine-ldc"; + executable = true; + src = self; + inherit shell; + inherit devEnv; + buildInputs = with pkgs; [sqlite]; + nativeBuildInputs = with pkgs; [dub ldc gnumake]; + buildPhase = '' + runHook preBuild + dub build --cache=local --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all + runHook postBuild + ''; + inherit checkPhase; + inherit installPhase; + inherit postInstall; + }; + #spine-overlay-gdc = stdenv.mkDerivation { # inherit pname; # inherit version; # meta.mainProgram = "spine-gdc"; @@ -170,57 +189,57 @@ ''; in with pkgs-ovl; { - devShell = mkShell { + dsh-overlay = mkShell { name = "spine base dev shell"; inherit shell; inherit devEnv; #buildInputs = [ sqlite ]; #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ - sqlite ldc #dmd dub gnumake + sqlite ]; inherit shellHook; }; - devShell-dmd = mkShell { + dsh-overlay-dmd-dub = mkShell { name = "spine base dev shell"; inherit shell; inherit devEnv; #buildInputs = [ sqlite ]; #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ - sqlite dmd dub gnumake + sqlite ]; inherit shellHook; }; - devShell-ldc = mkShell { + dsh-overlay-ldc-dub = mkShell { name = "spine base dev shell"; inherit shell; inherit devEnv; #buildInputs = [ sqlite ]; #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ - sqlite ldc dub gnumake + sqlite ]; inherit shellHook; }; - devShell-epub = mkShell { + dsh-epub = mkShell { name = "spine dev shell for epub output"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite libxml2 @@ -240,27 +259,27 @@ ]; inherit shellHook; }; - devShell-html = mkShell { + dsh-html = mkShell { name = "spine dev shell for latex & pdf output"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite ]; inherit shellHook; }; - devShell-latex-pdf = mkShell { + dsh-latex-pdf = mkShell { name = "spine dev shell for latex & pdf output"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite source-sans-pro @@ -270,27 +289,27 @@ ]; inherit shellHook; }; - devShell-sqlite = mkShell { + dsh-sqlite = mkShell { name = "spine dev shell for latex & pdf output"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite ]; inherit shellHook; }; - devShell-i18n = mkShell { + dsh-i18n = mkShell { name = "spine dev shell internationalization, po4a"; inherit shell; inherit devEnv; packages = [ - dub - #dmd ldc + #dmd + dub gnumake sqlite perl534Packages.Po4a @@ -361,28 +380,10 @@ with pkgs; # perl534Packages.Po4a ]; shellHook = '' - echo ' - shell.nix echo ❯❯ - - ❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" -c zsh - - ❯❯ nix develop - ❯❯ nix develop -c zsh - - ❯❯ nix build - ❯❯ nix build ".#default" --print-build-logs - ❯❯ nix build ".#spine-dmd" --print-build-logs |& nom - ❯❯ nix build ".#spine-ldc" --print-build-logs |& nom - ❯❯ nix build ".#spine-gdc" --print-build-logs |& nom - - ❯❯ nix profile install . - ' ''; } #+END_SRC -echo "ldc `${pkgs.ldc}/bin/ldc2 -v`" - ** default.nix :default: #+HEADER: :tangle ../default.nix @@ -872,7 +873,7 @@ webserv: data_root_url: "https://sisudoc.org" data_root_path: "/srv/www/spine" images_root_part: "image" - cgi_search_form_title: "≅ SiSU Spine search" + cgi_search_form_title: "≅ SiSU Spine search ፨" cgi_http: "https" cgi_domain: "sisudoc.org" cgi_bin_url: "http://sisudoc.org/cgi-bin" diff --git a/shell.nix b/shell.nix index 68d6de9..8187445 100755 --- a/shell.nix +++ b/shell.nix @@ -51,21 +51,5 @@ with pkgs; # perl534Packages.Po4a ]; shellHook = '' - echo ' - shell.nix echo ❯❯ - - ❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" -c zsh - - ❯❯ nix develop - ❯❯ nix develop -c zsh - - ❯❯ nix build - ❯❯ nix build ".#default" --print-build-logs - ❯❯ nix build ".#spine-dmd" --print-build-logs |& nom - ❯❯ nix build ".#spine-ldc" --print-build-logs |& nom - ❯❯ nix build ".#spine-gdc" --print-build-logs |& nom - - ❯❯ nix profile install . - ' ''; } -- cgit v1.2.3