aboutsummaryrefslogtreecommitdiffhomepage
path: root/org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2022-09-28 18:33:09 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2022-10-03 21:58:01 -0400
commit3b6e0279c4afffc8b11cd7d881e0a8b6f43aa431 (patch)
treed919fa206e169300caa05bce77e6a79fd2d7803c /org
parentorg noweb adjustments (diff)
org nix
Diffstat (limited to 'org')
-rw-r--r--org/config_git.org5
-rw-r--r--org/config_make.org57
-rw-r--r--org/config_nix.org284
3 files changed, 255 insertions, 91 deletions
diff --git a/org/config_git.org b/org/config_git.org
index abdfd33..18146d3 100644
--- a/org/config_git.org
+++ b/org/config_git.org
@@ -23,8 +23,10 @@
#+HEADER: :tangle "../.gitignore"
#+BEGIN_SRC sh
# git ls-files --others --exclude-from=.git/info/exclude
+# git clean -ix
,*
!.gitignore
+!.gitattributes
!README.md
!README
!COPYRIGHT
@@ -51,6 +53,7 @@
!*.nix
!nix
!nix/**
+!flake.lock
!.envrc
!.envrc-local_
!.dr
@@ -111,6 +114,7 @@ tmp/**
#+HEADER: :tangle "../sundry/spine_search_cgi/.gitignore"
#+BEGIN_SRC sh
# git ls-files --others --exclude-from=.git/info/exclude
+# git clean -ix
,*
!.gitignore
!README.md
@@ -131,6 +135,7 @@ tmp/**
!*.nix
!nix
!nix/**
+!flake.lock
!.envrc
!src
!src/**
diff --git a/org/config_make.org b/org/config_make.org
index 2845135..42c5fb4 100644
--- a/org/config_make.org
+++ b/org/config_make.org
@@ -69,6 +69,7 @@
<<make_version_tag>>
<<make_changelog>>
<<make_project_zip_archive>>
+<<nixGitHEADtarball>>
<<make_get_project_dependencies_github>>
<<make_dub_upgrade>>
<<make_compile_compiler_default>>
@@ -300,8 +301,6 @@ SpineSearchActionLocal := 'http://localhost/spine_search'
SpineSearchActionRemote := 'https://sisudoc.org/spine_search'
SpineCGIform := 'spine_search'
SpineSQLdb := 'spine.search.db'
-PROG_VER_GIT := '''`git describe --long --tags | sed -e "s/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g"`'''
-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'`'''
hwd := `pwd`
gwd := `pwd` + "/src/ext_depends"
deps := "`ls -gx './src/ext_depends'`"
@@ -673,21 +672,67 @@ depends_set: depends_get
#+NAME: make_project_zip_archive
#+BEGIN_SRC makefile
gitZip:
- git archive -v --format=tar --prefix=`echo spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT)`/ HEAD | gzip > ../spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT).tar.gz && \
+ 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"
# git archive project, produce current state .tar.gz
gitArchive:
- git archive -v --format=tar --prefix=spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT)/ HEAD | gzip > ../spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT).tar.gz && \
+ git archive -v --format=tar --prefix=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"
# git archive project, produce current state .tar.gz
# gitArchive:
-# git archive -v --format=tar --prefix="spine-{{PROG_VER_DECLARED}}-tag-{{PROG_VER_GIT}}/" HEAD | gzip > ../spine-{{PROG_VER_DECLARED}}-tag-{{PROG_VER_GIT}}.tar.gz && \
+# git archive -v --format=tar --prefix="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"
#+END_SRC
+*** nixGitHEADtarball
+
+#+NAME: nixGitHEADtarball
+#+HEADER: :noweb yes
+#+BEGIN_SRC makefile
+# remove test tarball dir
+nixGitHEADtarballClean:
+ if [ -d "./tarballGitHEAD" ]; then \
+ rm -rv ./tarballGitHEAD; \
+ fi;
+
+# create test tarball
+nixGitHEADtarballTar:
+ if [ ! -d "./tarballGitHEAD" ]; then \
+ mkdir ./tarballGitHEAD; \
+ fi; \
+ git archive -v --format=tar --prefix="spine-${PROG_VER_DECLARED}/" HEAD | \
+ gzip > ./tarballGitHEAD/spine-${PROG_VER_DECLARED}-tag-${PROG_VER_GIT}.tar.gz && \
+ cp -v ./tarballGitHEAD/spine-${PROG_VER_DECLARED}-tag-${PROG_VER_GIT}.tar.gz ./tarballGitHEAD/spine-${PROG_VER_DECLARED}.tar.gz && \
+ echo "to unzip: tar -xzf spine-${PROG_VER_DECLARED}-tag-${PROG_VER_GIT}.tar.gz"; \
+ echo "to unzip: tar -xzf spine-${PROG_VER_DECLARED}.tar.gz"
+
+# check test tarball
+nixGitHEADtarballCheck:
+ nix flake check <<nixGitUrl>>/spine-${PROG_VER_DECLARED}.tar.gz; \
+ nix flake lock <<nixGitUrl>>/spine-${PROG_VER_DECLARED}.tar.gz; \
+ nix flake show <<nixGitUrl>>/spine-${PROG_VER_DECLARED}.tar.gz;
+
+# build test tarball
+nixGitHEADtarballBuild:
+ echo "nix build <<nixGitUrl>>/spine-${PROG_VER_DECLARED}.tar.gz#spine --print-build-logs"
+ nix build <<nixGitUrl>>/spine-${PROG_VER_DECLARED}.tar.gz#spine --print-build-logs
+ #nix build "./tarballGitHEAD/spine-${PROG_VER_DECLARED}.tar.gz#spine" --print-build-logs
+
+# clean create check & build test tarball
+nixGitHEADtarball: nixGitHEADtarballClean nixGitHEADtarballTar nixGitHEADtarballCheck nixGitHEADtarballBuild
+
+#+END_SRC
+
+**** Url nixGitHEADtarball
+
+#+NAME: nixGitUrl
+#+BEGIN_SRC makefile
+file://${hwd}/tarballGitHEAD
+#+END_SRC
+
*** _make_ commands [+2] :make:commands:
- build commands
@@ -1046,7 +1091,7 @@ rm_flakelock:
flake_update:
git add .; \
- nix flake update && \
+ nix flake lock && \
git reset HEAD flake.lock; \
cp flake.lock flake.lock_
diff --git a/org/config_nix.org b/org/config_nix.org
index d6df3aa..92576e0 100644
--- a/org/config_nix.org
+++ b/org/config_nix.org
@@ -73,13 +73,16 @@ nix show-derivation /nix/store/q7n14bm8j5vzm62qaraczdb4bpyf59vv-spine-0.11.1.drv
*** 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
-use flake
+use flake .
NIX_ENFORCE_PURITY=1
NixDirEnvVersion="2.1.2"
if ! has nix_direnv_version || ! nix_direnv_version ${NixDirEnvVersion}; then
-# https://github.com/nix-community/nix-direnv
+# - 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="
fi
@@ -144,6 +147,7 @@ fi
#+HEADER: :noweb yes
#+BEGIN_SRC nix
echo ".envrc called .envrc-local"
+PATH_add result/bin
export NIX_PATH=<<nix_path_channel>>
#export NIX_PATH=<<nixpkgs_path_local>>
export DFLAGS="-O2 -inline"
@@ -169,11 +173,6 @@ 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
-
-if [ -f .env/echo-nixNote ]; then
- source .env/echo-nixNote
-fi
#+END_SRC
**** .env/echo-nixNote CHECK MODIFY
@@ -472,7 +471,7 @@ postInstall:
- nix develop
-- nix flake update
+- nix flake lock
- nix shell -f default.nix --print-build-logs
- nix shell -c default.nix
@@ -544,8 +543,23 @@ postInstall:
runHook postInstall
'';
postInstall = ''
- echo "$out/share/cgi-bin"
+ 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
@@ -554,7 +568,7 @@ postInstall:
sqlite
];
};
- defaultPackage.x86_64-linux = self.packages.x86_64-linux.spine;
+ packages.x86_64-linux.default = self.packages.x86_64-linux.spine;
};
}
#+END_SRC
@@ -628,8 +642,176 @@ postInstall:
#+END_SRC
*** shell.nix :shell:
-**** NOTES
+**** tangle
+#+HEADER: :tangle ../shell.nix
+#+HEADER: :tangle-mode (identity #o755)
+#+HEADER: :shebang "#!/usr/bin/env -S nix-shell --pure"
+#+HEADER: :noweb yes
+#+BEGIN_SRC nix
+#!nix-shell -i bash
+{ pkgs ? import <nixpkgs> {} }:
+with pkgs;
+mkShell {
+ buildInputs = [
+ ### nix_related
+ direnv
+ nixVersions.unstable #nixFlakes
+ nix-prefetch-git
+ validatePkgConfig
+ nix-tree jq
+ 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 lock --update-input nixpkgs
+ 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 ""
+ 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 .#spine --print-build-logs'
+ echo ' nix develop --build -f derivation.nix -I .envrc --print-build-logs'
+ echo ' nix develop ; eval "$buildPhase"'
+ echo ""
+ echo 'spine -v'
+ echo "examine"
+ echo ' nix-instantiate | nix show-derivation | jq'
+ echo ' nix-build . --no-out-link | xargs -o nix-tree'
+ echo ' nix-tree --derivation .#spine'
+ echo ""
+ #echo "ldc `${pkgs.ldc}/bin/ldc2 -v`"
+ '';
+}
+#+END_SRC
+
+**** Notes
+
+#+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 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 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 build .#spine
+
+# [ nix run ]
+
+ # - nix run default.nix --print-build-logs
+ # - nix run -I .envrc default.nix --print-build-logs
+ # - nix run .#spine
+
+# - 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
+
+#+BEGIN_SRC text
+#% Notes
- nix-shell
- shell.nix --pure
@@ -674,74 +856,6 @@ postInstall:
- nix develop --build -f derivation.nix -I .envrc --print-build-logs
./result/bin/spine
-
-**** tangle
-
-#+HEADER: :tangle ../shell.nix
-#+HEADER: :tangle-mode (identity #o755)
-#+HEADER: :shebang "#!/usr/bin/env -S nix-shell --pure"
-#+HEADER: :noweb yes
-#+BEGIN_SRC nix
-{ pkgs ? import <nixpkgs> {} }:
-with pkgs;
-mkShell {
- buildInputs = [
- <<shell_packages_nix_related>>
- <<shell_packages_d_build_related>>
- <<shell_packages_search_related_sqlite>>
- # <<shell_packages_pdf_latex_related>>
- # <<shell_packages_xml_and_epub_related>>
- # <<shell_packages_i18n_translation>>
- <<shell_packages_candy>>
- ];
- shellHook = ''
- if [[ -f ".envrc" ]]; then
- source .envrc
- fi
- '';
-}
-
-# - shell.nix -I .envrc
-# - shell.nix -I .envrc --pure
-# - nix-shell -I nixpkgs=<<nixpkgs_local>> --pure
-# - nix-shell -p "with import <<nixpkgs_local>> {}; ldc" --pure
-# - nix-shell -p "with import <<nixpkgs_local>> {}; [dub ldc]" --pure
-
-# - nix-shell -p nixFlakes
-# - nix-shell -p nixFlakes --pure
-# - nix-shell -p nixFlakes --pure -p "with import <<nixpkgs_local>> {}; [nix dub ldc]"
-# - nix-shell shell.nix direnv: export +IN_NIX_SHELL
-# - nix-shell shell.nix
-
-# - nix-build -I nixpkgs=<<nixpkgs_local>> --pure
-# - nix-build -I .envrc --pure
-# - nix-build default.nix -I .envrc && results/bin/spine -v
-
-# - 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 -c default.nix
-
-# - nix shell -f default.nix --print-build-logs
-
-# - 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 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
#+END_SRC
**** parts
@@ -751,7 +865,7 @@ mkShell {
#+BEGIN_SRC nix
### nix_related
direnv
-nixFlakes
+nixVersions.unstable #nixFlakes
nix-prefetch-git
validatePkgConfig
jq
@@ -988,7 +1102,7 @@ mkDubDerivation rec {
ldc
];
buildInputs = with pkgs; [
- nixFlakes
+ nixVersions.unstable #nixFlakes
sqlite
];
meta = with pkgs.lib; {
@@ -1120,7 +1234,7 @@ with pkgs; [
#+NAME: nix_shell_with_pkgs_list
#+BEGIN_SRC nix
-nixFlakes
+nixVersions.unstable #nixFlakes
rund
dub
ldc
@@ -1300,7 +1414,7 @@ $SpineBIN/spine -v --cgi-search-form-codegen --config=$SpinePOD/.dr/config_local
nix develop
-nix flake update
+nix flake lock
#+HEADER: :tangle "../sundry/spine_search_cgi/flake.nix"
#+HEADER: :noweb yes
@@ -1462,7 +1576,7 @@ mkDubDerivation rec {
buildInputs = [
pkgs.sqlite (
with pkgs; [
- nixFlakes
+ nixVersions.unstable #nixFlakes
## package manager
dub
## compiler
@@ -1627,7 +1741,7 @@ github:nixos/nixpkgs
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = with pkgs; [
- nixFlakes
+ nixVersions.unstable #nixFlakes
nix-prefetch-git
validatePkgConfig
jq