aboutsummaryrefslogtreecommitdiffhomepage
path: root/org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2022-07-31 15:44:56 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2022-08-03 19:18:15 -0400
commit934b830f804c1acae1e5f2f55207a1f428244f1f (patch)
tree8b55d1cbc25cbaf59e2ac94db51c809b9f1cc1ab /org
parentocn metaverse, rearrange (diff)
org nix adjust
Diffstat (limited to 'org')
-rw-r--r--org/config_nix.org191
1 files changed, 128 insertions, 63 deletions
diff --git a/org/config_nix.org b/org/config_nix.org
index 0bd4f50..719c378 100644
--- a/org/config_nix.org
+++ b/org/config_nix.org
@@ -8,7 +8,7 @@
#+LANGUAGE: en
#+STARTUP: content hideblocks hidestars noindent entitiespretty
#+PROPERTY: header-args :exports code
-#+PROPERTY: header-args+ :noweb tangle
+#+PROPERTY: header-args+ :noweb yes
#+PROPERTY: header-args+ :results no
#+PROPERTY: header-args+ :cache no
#+PROPERTY: header-args+ :padline no
@@ -16,6 +16,12 @@
#+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t
* nix :nix:
+
+#+NAME: nixpkgs_local
+#+BEGIN_SRC sh
+/nixpkgs-ra/nixpkgs
+#+END_SRC
+
** NOTES
*** nix-shell
@@ -39,21 +45,15 @@ nix-build project.nix
#+BEGIN_SRC sh
nix-shell --pure
-nix-build -I nixpkgs=/nixpkgs-ra/nixpkgs
-#+END_SRC
-
-- project.nix
-
-#+BEGIN_SRC sh
-nix-shell --pure
-nix-build -I nixpkgs=/nixpkgs-ra/nixpkgs
+nix-build -I nixpkgs=<<nixpkgs_local>>
+nix-build -I .envrc --pure
#+END_SRC
#+BEGIN_SRC sh
-nix build
-nix build -f default.nix
-nix build -f project.nix
-nix build -f spine.nix
+nix build -f default.nix --print-build-logs
+nix build -f derivation.nix --print-build-logs
+nix shell -f default.nix --print-build-logs
+nix develop --build -f derivation.nix -I .envrc --print-build-logs
#+END_SRC
*** derivation .drv
@@ -73,12 +73,14 @@ nix show-derivation /nix/store/q7n14bm8j5vzm62qaraczdb4bpyf59vv-spine-0.11.1.drv
#+HEADER: :tangle ../.envrc
#+BEGIN_SRC sh
NIX_ENFORCE_PURITY=0
-if ! has nix_direnv_version || ! nix_direnv_version 1.4.0; then
+NixDirEnvVersion="2.1.2"
+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/1.4.0/direnvrc" "sha256-4XfVDjv75eHMWN4G725VW7BoOV4Vl3vAabK4YXIfPyE="
+# 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
-if [ -e .env/local ]; then
- source_env_if_exists .env/local || source .env/local
+if [ -f .envrc-local ]; then
+ source_env_if_exists .envrc-local || source .envrc-local
fi
#+END_SRC
@@ -93,8 +95,8 @@ else # fallback prevent bootstrapping problems by using direnv's builtin nix sup
use nix
NIX_ENFORCE_PURITY=0
fi
-if [ -e .env/local ]; then
- source_env_if_exists .env/local || source .env/local
+if [ -f .envrc-local ]; then
+ source_env_if_exists .envrc-local || source .envrc-local
fi
#+END_SRC
@@ -124,18 +126,19 @@ else
use nix
NIX_ENFORCE_PURITY=0
fi
- if [ -e .env/local ]; then
- source_env_if_exists .env/local || source .env/local
+ if [ -f .envrc-local ]; then
+ source_env_if_exists .envrc-local || source .envrc-local
fi
fi
#+END_SRC
-**** .env/local CHECK MODIFY
+**** .envrc-local CHECK MODIFY
- bespoke modify appropriately and generate if needed
-#+HEADER: :tangle ../.env/local_
-#+BEGIN_SRC sh
+#+HEADER: :tangle ../.envrc-local_
+#+BEGIN_SRC nix
+echo ".envrc called .envrc-local"
export NIX_PATH=<<nix_path_channel>>
#export NIX_PATH=<<nixpkgs_path_local>>
export DFLAGS="-O2 -inline"
@@ -161,9 +164,10 @@ 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 [ -e .env/echo-nixNote ]; then
- source .env/echo-nixNote
+if [ -f .env/echo-nixNote ]; then
+ source .env/echo-nixNote
fi
#+END_SRC
@@ -186,16 +190,23 @@ echo '
,#+BEGIN_SRC sh
nix-shell --pure
-nix-build
-nix build -f default.nix
-nix shell -f default.nix
+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
+
nix-instantiate | nix-build
+
+nix-instantiate -I .envrc | nix-build -I .envrc
nix build `nix-instantiate`
+nix build `nix-instantiate -I .envrc`
nix develop
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 search --json 2>/dev/null |jq
,#+END_SRC
@@ -457,12 +468,13 @@ postInstall:
- nix flake update
-- nix shell -f default.nix
+- nix shell -f default.nix --print-build-logs
- nix shell -c default.nix
-- nix build
- nix build `nix-instantiate`
-- nix build -f default.nix
+- 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
- nix search --json 2>/dev/null |jq
- nix flake show
@@ -614,8 +626,8 @@ postInstall:
- shell.nix --pure
- shell.nix --pure -I .envrc
-- nix-shell --pure -I nixpkgs=/nixpkgs-ra/nixpkgs
-- nix-shell --pure -p "with import /nixpkgs-ra/nixpkgs {}; ldc"
+- nix-shell --pure -I nixpkgs=<<nixpkgs_local>>
+- nix-shell --pure -p "with import <<nixpkgs_local>> {}; ldc"
- nix-shell --pure -p "with import /nixpkgs-ra/nixpkgs {}; [dub ldc]"
- shell.nix direnv: export +IN_NIX_SHELL
@@ -637,20 +649,20 @@ postInstall:
- nix develop
-- nix-build
- nix-build -I nixpkgs=<provide local nix path>
- nix-build -I .envrc
-- nix build --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 -I .envrc --print-build-logs
+- nix shell -f default.nix --print-build-logs
+- nix develop --build -f derivation.nix -I .envrc --print-build-logs
+
- buildPhase
- nix build -f default.nix && noti
- nix build -f default.nix && ./result/bin/spine -v && noti -t "spine build" -m "see ./result/bin/spine"
-
+- nix develop --build -f derivation.nix -I .envrc --print-build-logs
./result/bin/spine
@@ -673,12 +685,53 @@ mkShell {
<<shell_packages_candy>>
];
shellHook = ''
- if [[ -e ".envrc" ]]; then
+ if [[ -f ".envrc" ]]; then
source .envrc
fi
eval "$(starship init bash)"
'';
}
+
+# - 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>> {}; [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 --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
#+END_SRC
**** parts
@@ -687,11 +740,13 @@ mkShell {
#+NAME: shell_packages_nix_related
#+BEGIN_SRC nix
### nix_related
+direnv
nixFlakes
nix-prefetch-git
validatePkgConfig
jq
git
+#ps
#+END_SRC
***** packages d build related
@@ -788,7 +843,7 @@ pkgs.mkShell {
buildPhase = "nix build -f default.nix";
shellHook = ''
echo "built spine @ ./result/bin/spine"
- if [[ -e ".envrc" ]]; then
+ if [[ -f ".envrc" ]]; then
source .envrc
fi
nix-instantiate | nix show-derivation | jq
@@ -802,19 +857,22 @@ pkgs.mkShell {
e.g. default.nix -I nixpkgs=/nixpkgs-ra/nixpkgs
- nix-build -I nixpkgs=<provide local nix path>
- e.g. nix-build -I nixpkgs=/nixpkgs-ra/nixpkgs
+ e.g. nix-build -I nixpkgs=<<nixpkgs_local>>
#+BEGIN_SRC sh
-nix-build -I nixpkgs=/nixpkgs-ra/nixpkgs
-nix-build -I .env/local
+nix-build -I nixpkgs=<<nixpkgs_local>>
+nix-build -I .envrc-local
nix-build -I .envrc
default.nix -I .envrc
default.nix
-nix build
-nix build -f default.nix
-nix build -f project.nix
-nix build -f spine.nix
+nix build -f default.nix --print-build-logs
+nix build -f derivation.nix --print-build-logs
+nix shell -f default.nix --print-build-logs
+nix develop --build -f derivation.nix -I .envrc --print-build-logs
+
+# nix build -f project.nix
+# nix build -f spine.nix
#+END_SRC
#+HEADER: :tangle ../default.nix
@@ -1071,17 +1129,17 @@ if ! has nix_direnv_version || ! nix_direnv_version 1.4.0; then
# https://github.com/nix-community/nix-direnv
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/1.4.0/direnvrc" "sha256-4XfVDjv75eHMWN4G725VW7BoOV4Vl3vAabK4YXIfPyE="
fi
-if [ -e .env/local ]; then
- source_env_if_exists .env/local || source .env/local
+if [ -f .envrc-local ]; then
+ source_env_if_exists .envrc-local || source .envrc-local
fi
#+END_SRC
-**** .env/local
+**** .envrc-local
-#+HEADER: :tangle "../sundry/spine_search_cgi/.env/local_"
-#+BEGIN_SRC sh
-export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos
-#export NIX_PATH=nixpkgs=/nixpkgs-ra/nixpkgs
+#+HEADER: :tangle "../sundry/spine_search_cgi/.envrc-local_"
+#+BEGIN_SRC nix
+export NIX_PATH=<<nix_path_channel>>
+#export NIX_PATH=nixpkgs=<<nixpkgs_local>>
# reload when these files change
# watch_file flake.nix
# watch_file flake.lock
@@ -1098,12 +1156,12 @@ export SpinePOD=$SpineDOC/markup/pod
export SpineOUT=<<project_path_local_out_static>>
export SpineDBpath=<<project_path_sqlite>>
export SpineCgiBIN=<<project_path_cgi_bin>>
-if [ -e .env/echo-nixNote ]; then # source an additional user-specific .envrc in ./.env/local
+if [ -e .env/echo-nixNote ]; then # source an additional user-specific .envrc in ./.envrc-local
source .env/echo-nixNote
fi
#+END_SRC
-**** .env/local
+**** .envrc-local
#+HEADER: :tangle "../sundry/spine_search_cgi/.env/echo-nixNote"
#+BEGIN_SRC sh
@@ -1123,8 +1181,9 @@ echo '
nix-shell --pure
nix-build
-nix build -f default.nix
-nix shell -f default.nix
+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
nix-instantiate | nix-build
nix build `nix-instantiate`
@@ -1272,7 +1331,7 @@ mkShell {
<<shell_packages_candy>>
];
shellHook = ''
- if [[ -e ".envrc" ]]; then
+ if [[ -f ".envrc" ]]; then
source .envrc
fi
eval "$(starship init bash)"
@@ -1451,26 +1510,31 @@ spine_search
- <nixpkgs>
#+NAME: nixpkgs_path_default
+#+HEADER: :noweb yes
#+BEGIN_SRC nix
<nixpkgs>
#+END_SRC
#+NAME: nix_path_directory
+#+HEADER: :noweb yes
#+BEGIN_SRC nix
nixpkgs=<<nixpkgs_path_local>>
#+END_SRC
#+NAME: project_path_local_project
+#+HEADER: :noweb yes
#+BEGIN_SRC nix
/grotto-ra/repo/git.repo/projects/project-spine/doc-reform
#+END_SRC
#+NAME: project_path_local_src
+#+HEADER: :noweb yes
#+BEGIN_SRC nix
-/grotto-ra/repo/git.repo/projects/project-spine/doc-reform/src
+<<project_path_local_project>>/src
#+END_SRC
#+NAME: project_path_local_bin
+#+HEADER: :noweb yes
#+BEGIN_SRC nix
<<project_path_local_project>>/result/bin
#+END_SRC
@@ -1491,11 +1555,13 @@ nixpkgs=<<nixpkgs_path_local>>
#+END_SRC
#+NAME: project_path_local_out_
+#+HEADER: :noweb yes
#+BEGIN_SRC nix
/tmp/spine/$SpineVER/www
#+END_SRC
#+NAME: project_path_local_out_static
+#+HEADER: :noweb yes
#+BEGIN_SRC nix
/srv/www/spine
#+END_SRC
@@ -1505,7 +1571,6 @@ nixpkgs=<<nixpkgs_path_local>>
/var/www
#+END_SRC
-
#+NAME: project_path_sqlite
#+BEGIN_SRC nix
/var/www/sqlite
@@ -1567,7 +1632,7 @@ pkgs.mkShell {
# liberation_ttf
#];
shellHook = ''
- if [[ -e ".envrc" ]]; then
+ if [[ -f ".envrc" ]]; then
source .envrc
fi
#for texfile in *.tex; do xelatex -interaction=nonstopmode $texfile; done