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.org284
1 files changed, 199 insertions, 85 deletions
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