From 3b6e0279c4afffc8b11cd7d881e0a8b6f43aa431 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 28 Sep 2022 18:33:09 -0400 Subject: org nix --- .env/echo-nixNote | 1 + .envrc | 5 +- .gitattributes | 4 + .gitignore | 4 + derivation.nix | 2 +- flake.nix | 19 ++- makefile | 42 ++++- org/config_git.org | 5 + org/config_make.org | 57 ++++++- org/config_nix.org | 284 +++++++++++++++++++++++---------- shell.nix | 88 +++++----- sundry/spine_search_cgi/.gitignore | 2 + sundry/spine_search_cgi/derivation.nix | 2 +- sundry/spine_search_cgi/shell.nix | 6 +- 14 files changed, 365 insertions(+), 156 deletions(-) create mode 100644 .gitattributes diff --git a/.env/echo-nixNote b/.env/echo-nixNote index 98449bb..ad8717f 100644 --- a/.env/echo-nixNote +++ b/.env/echo-nixNote @@ -13,6 +13,7 @@ echo ' #+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 diff --git a/.envrc b/.envrc index a63ea48..c3db812 100644 --- a/.envrc +++ b/.envrc @@ -1,7 +1,8 @@ -NIX_ENFORCE_PURITY=0 +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 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..71dd947 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +/org export-ignore +/subprojects export-ignore +.gitattributes export-ignore +tangle export-ignore diff --git a/.gitignore b/.gitignore index a0eb6c8..60abc99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ # git ls-files --others --exclude-from=.git/info/exclude +# git clean -ix * !.gitignore +!.gitattributes !README.md !README !COPYRIGHT @@ -27,7 +29,9 @@ !*.nix !nix !nix/** +!flake.lock !.envrc +!.envrc-local_ !.dr !.dr/* !src diff --git a/derivation.nix b/derivation.nix index 6aa38cb..3988e7c 100644 --- a/derivation.nix +++ b/derivation.nix @@ -87,7 +87,7 @@ mkDubDerivation rec { ldc ]; buildInputs = with pkgs; [ - nixFlakes + nixVersions.unstable #nixFlakes sqlite ]; meta = with pkgs.lib; { diff --git a/flake.nix b/flake.nix index d57ddc4..3fa66fa 100644 --- a/flake.nix +++ b/flake.nix @@ -51,8 +51,23 @@ 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 @@ -61,6 +76,6 @@ sqlite ]; }; - defaultPackage.x86_64-linux = self.packages.x86_64-linux.spine; + packages.x86_64-linux.default = self.packages.x86_64-linux.spine; }; } diff --git a/makefile b/makefile index 6b76b0a..77894c2 100644 --- a/makefile +++ b/makefile @@ -87,8 +87,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'`" @@ -467,19 +465,51 @@ 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_ 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" +# 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 lock file://${hwd}/tarballGitHEAD/spine-${PROG_VER_DECLARED}.tar.gz; \ + nix flake check file://${hwd}/tarballGitHEAD/spine-${PROG_VER_DECLARED}.tar.gz; \ + nix flake show file://${hwd}/tarballGitHEAD/spine-${PROG_VER_DECLARED}.tar.gz; + +# build test tarball +nixGitHEADtarballBuild: + echo "nix build file://${hwd}/tarballGitHEAD/spine-${PROG_VER_DECLARED}.tar.gz#spine --print-build-logs" + nix build file://${hwd}/tarballGitHEAD/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 + get_depends: hwd=$$(echo `pwd`) && \ gwd="$${hwd}/src/ext_depends" && \ @@ -529,7 +559,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_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 @@ <> <> <> +<> <> <> <> @@ -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 <>/spine-${PROG_VER_DECLARED}.tar.gz; \ + nix flake lock <>/spine-${PROG_VER_DECLARED}.tar.gz; \ + nix flake show <>/spine-${PROG_VER_DECLARED}.tar.gz; + +# build test tarball +nixGitHEADtarballBuild: + echo "nix build <>/spine-${PROG_VER_DECLARED}.tar.gz#spine --print-build-logs" + nix build <>/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=<> #export NIX_PATH=<> 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 {} }: +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 {} }: -with pkgs; -mkShell { - buildInputs = [ - <> - <> - <> - # <> - # <> - # <> - <> - ]; - shellHook = '' - if [[ -f ".envrc" ]]; then - source .envrc - fi - ''; -} - -# - shell.nix -I .envrc -# - shell.nix -I .envrc --pure -# - nix-shell -I nixpkgs=<> --pure -# - nix-shell -p "with import <> {}; ldc" --pure -# - nix-shell -p "with import <> {}; [dub ldc]" --pure - -# - nix-shell -p nixFlakes -# - nix-shell -p nixFlakes --pure -# - nix-shell -p nixFlakes --pure -p "with import <> {}; [nix dub ldc]" -# - nix-shell shell.nix direnv: export +IN_NIX_SHELL -# - nix-shell shell.nix - -# - nix-build -I nixpkgs=<> --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 {} }: pkgs.mkShell { buildInputs = with pkgs; [ - nixFlakes + nixVersions.unstable #nixFlakes nix-prefetch-git validatePkgConfig jq diff --git a/shell.nix b/shell.nix index e27e127..07031df 100755 --- a/shell.nix +++ b/shell.nix @@ -1,16 +1,17 @@ #!/usr/bin/env -S nix-shell --pure +#!nix-shell -i bash { pkgs ? import {} }: with pkgs; mkShell { buildInputs = [ ### nix_related direnv - nixFlakes + nixVersions.unstable #nixFlakes nix-prefetch-git validatePkgConfig - jq + nix-tree jq git - #ps + ps ### d_build_related ## package manager dub @@ -43,54 +44,43 @@ mkShell { # ### i18n translation related # perl534Packages.Po4a ### candy - jq starship ]; shellHook = '' - if [[ -f ".envrc" ]]; then - source .envrc - fi - eval "$(starship init bash)" + #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`" ''; } - -# - shell.nix -I .envrc -# - shell.nix -I .envrc --pure -# - 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 {}; [dub ldc]" -# - nix-shell shell.nix direnv: export +IN_NIX_SHELL -# - nix-shell shell.nix - -# - nix-build -I nixpkgs=/nixpkgs-ra/nixpkgs --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 --pure -# - nix build -f default.nix --print-build-logs --pure -# - nix build -f derivation.nix --print-build-logs --pure - -# - 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 develop --build -f derivation.nix -I .envrc --print-build-logs diff --git a/sundry/spine_search_cgi/.gitignore b/sundry/spine_search_cgi/.gitignore index d9d6575..7673ca9 100644 --- a/sundry/spine_search_cgi/.gitignore +++ b/sundry/spine_search_cgi/.gitignore @@ -1,4 +1,5 @@ # git ls-files --others --exclude-from=.git/info/exclude +# git clean -ix * !.gitignore !README.md @@ -19,6 +20,7 @@ !*.nix !nix !nix/** +!flake.lock !.envrc !src !src/** diff --git a/sundry/spine_search_cgi/derivation.nix b/sundry/spine_search_cgi/derivation.nix index f3c9959..6b1b6e6 100644 --- a/sundry/spine_search_cgi/derivation.nix +++ b/sundry/spine_search_cgi/derivation.nix @@ -90,7 +90,7 @@ mkDubDerivation rec { buildInputs = [ pkgs.sqlite ( with pkgs; [ - nixFlakes + nixVersions.unstable #nixFlakes ## package manager dub ## compiler diff --git a/sundry/spine_search_cgi/shell.nix b/sundry/spine_search_cgi/shell.nix index 64a4e02..d918d20 100755 --- a/sundry/spine_search_cgi/shell.nix +++ b/sundry/spine_search_cgi/shell.nix @@ -5,12 +5,12 @@ mkShell { buildInputs = [ ### nix_related direnv - nixFlakes + nixVersions.unstable #nixFlakes nix-prefetch-git validatePkgConfig jq git - #ps + ps ### d_build_related ## package manager dub @@ -30,13 +30,11 @@ mkShell { #wget aria ### candy - jq starship ]; shellHook = '' if [[ -f ".envrc" ]]; then source .envrc fi - eval "$(starship init bash)" ''; } -- cgit v1.2.3