aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/config_nix.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2021-09-20 20:02:10 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2021-10-22 21:28:50 -0400
commit85a2a2922673bfe44461e26b68cb1da0de5bb8c7 (patch)
tree974d815fecc851c9212bc0056c9df39a5a36c977 /org/config_nix.org
parentorg latex organize (diff)
nix related config, direnv else minor
Diffstat (limited to 'org/config_nix.org')
-rw-r--r--org/config_nix.org175
1 files changed, 92 insertions, 83 deletions
diff --git a/org/config_nix.org b/org/config_nix.org
index 35feaef..ab01b55 100644
--- a/org/config_nix.org
+++ b/org/config_nix.org
@@ -74,6 +74,10 @@ 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
+# 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 .envrc-local ]; then # source an additional user-specific .envrc in ./.envrc-local
source .envrc-local
fi
@@ -85,7 +89,7 @@ fi
#+BEGIN_SRC sh
if type lorri &>/dev/null; then
echo "direnv: using lorri from PATH ($(type -p lorri))"
- eval "$(lorri direnv)"
+ # eval "$(lorri direnv)"
else # fallback prevent bootstrapping problems by using direnv's builtin nix support
use nix
NIX_ENFORCE_PURITY=0
@@ -137,10 +141,10 @@ fi
export NIX_PATH=<<nix_path_channel>>
#export NIX_PATH=<<nixpkgs_path_local>>
# reload when these files change
-watch_file flake.nix
+# watch_file flake.nix
# watch_file flake.lock
## load the flake devShell
-eval "$(nix print-dev-env)"
+# eval "$(nix print-dev-env)"
# echo $NIX_BUILD_TOP
export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g')
export SpineSRC=<<project_path_local_src>>
@@ -148,16 +152,16 @@ export SpineBIN=<<project_path_local_bin>>
export SpineDOC=<<project_path_local_doc>>
export SpinePOD=$SpineDOC/markup/pod
export SpineOUTversioned=<<project_path_local_out>>
-export SpineOUTstatic=<<project_path_local_out_static>>
+export SpineOUT=<<project_path_local_out_static>>
echo '-*- mode: org -*-
,* nixpkgs path?
- eval "$(nix print-dev-env)"
-' > nix_note_.org
+ # eval "$(nix print-dev-env)"
+' > nixNote_.org
-echo " <nixpkgs> == `nix-instantiate --find-file nixpkgs`" >> nix_note_.org
+echo " <nixpkgs> == `nix-instantiate --find-file nixpkgs`" >> nixNote_.org
echo '
,* nix build and show derivation
@@ -181,12 +185,12 @@ nix search --json 2>/dev/null |jq
,* version and build info
-,#+BEGIN_SRC sh' >> nix_note_.org
+,#+BEGIN_SRC sh' >> nixNote_.org
-echo 'spine version (git) == $SpineVER' >> nix_note_.org
-echo "spine version (git) == $SpineVER" >> nix_note_.org
-echo 'nix-instantiate == `nix-instantiate`' >> nix_note_.org
-echo "nix-instantiate == `nix-instantiate`" >> nix_note_.org
+echo 'spine version (git) == $SpineVER' >> nixNote_.org
+echo "spine version (git) == $SpineVER" >> nixNote_.org
+echo 'nix-instantiate == `nix-instantiate`' >> nixNote_.org
+echo "nix-instantiate == `nix-instantiate`" >> nixNote_.org
echo "#+END_SRC
@@ -197,9 +201,9 @@ SpineSRC=$SpineSRC
SpineDOC=$SpineDOC
SpinePOD=$SpinePOD
SpineOUTversioned=$SpineOUTversioned
-SpineOUTstatic=$SpineOUTstatic
+SpineOUT=$SpineOUT
,#+END_SRC
-" >> nix_note_.org
+" >> nixNote_.org
echo '* spine run instruction examples
,** parallelized tasks
@@ -285,12 +289,12 @@ $SpineBIN/spine --show-config $SpinePOD
$SpineBIN/spine --show-config --output="$SpineOUTversioned" $SpinePOD
,#+END_SRC
-,** cgi operations (output to $SpineOUTstatic /var/www)
+,** cgi operations (output to $SpineOUT /var/www)
,#+BEGIN_SRC sh
-$SpineBIN/spine --very-verbose --sqlite-db-create --output="$SpineOUTstatic" $SpinePOD/*
+$SpineBIN/spine --very-verbose --sqlite-db-create --output="$SpineOUT" $SpinePOD/*
-$SpineBIN/spine -v --cgi-search-form-codegen --output=$SpineOUTstatic $SpinePOD/*
+$SpineBIN/spine -v --cgi-search-form-codegen --output=$SpineOUT $SpinePOD/*
$SpineBIN/spine -v --show-config --config=$SpinePOD/.dr
@@ -303,26 +307,26 @@ $SpineBIN/spine -v --cgi-search-form-codegen --config=$SpinePOD/.dr/config_local
,*** generate html linked to search form
,#+BEGIN_SRC sh
-$SpineBIN/spine -v --html --html-link-search --html-link-curate --curate --output=$SpineOUTstatic $SpinePOD/*
+$SpineBIN/spine -v --html --html-link-search --html-link-curate --curate --output=$SpineOUT $SpinePOD/*
,#+END_SRC
,*** create or re-create sql db (--sqlite-db-create or --sqlite-db-recreate)
,#+BEGIN_SRC sh
-$SpineBIN/spine -v --sqlite-db-create --sqlite-db-filename="<<spine_search_db>>" --output="$SpineOUTstatic"
-$SpineBIN/spine -v --sqlite-db-recreate --sqlite-db-filename="<<spine_search_db>>" --output="$SpineOUTstatic"
+$SpineBIN/spine -v --sqlite-db-create --sqlite-db-filename="<<spine_search_db>>" --output="$SpineOUT/"
+$SpineBIN/spine -v --sqlite-db-recreate --sqlite-db-filename="<<spine_search_db>>" --output="$SpineOUT/"
,#+END_SRC
,*** populate sqlite db
,#+BEGIN_SRC sh
-$SpineBIN/spine -v --sqlite-update --sqlite-db-filename="<<spine_search_db>>" --output=$SpineOUTstatic $SpinePOD/*
+$SpineBIN/spine -v --sqlite-update --sqlite-db-filename="<<spine_search_db>>" --output=$SpineOUT $SpinePOD/*
,#+END_SRC
,*** generate html (linked to search form), sql output, curate COMPOSITE
,#+BEGIN_SRC sh
-$SpineBIN/spine -v --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename="<<spine_search_db>>" --cgi-sqlite-search-filename="<<spine_search_cgi>>" --output="$SpineOUTstatic" $SpinePOD/*
+$SpineBIN/spine -v --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename="<<spine_search_db>>" --cgi-sqlite-search-filename="<<spine_search_cgi>>" --output="$SpineOUT" $SpinePOD/*
,#+END_SRC
,*** make search form
@@ -334,15 +338,15 @@ $SpineBIN/spine -v --cgi-search-form-codegen --config=$SpinePOD/.dr/config_local
,*** latex
,#+BEGIN_SRC sh
-$SpineBIN/spine --latex --serial --output="$SpineOUTstatic" $SpinePOD/*
+$SpineBIN/spine --latex --serial --output="$SpineOUT" $SpinePOD/*
ls $SpineOutstatic/latex/*.tex
,#+END_SRC
-' >> nix_note_.org
+' >> nixNote_.org
-cat nix_note_.org
+#cat nixNote_.org
-echo "emacs nix_note_.org"
-echo "cat nix_note_.org"
+#echo "emacs nixNote_.org"
+#echo "cat nixNote_.org"
#+END_SRC
*** flake :flake:
@@ -505,19 +509,19 @@ nix flake update
#+BEGIN_SRC nix
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
- buildInputs = with pkgs; [(
- with pkgs; [
- <<shell_packages_nix_related>>
- <<shell_packages_d_build_related>>
- # <<shell_packages_search_sqlite_related>>
- # <<shell_packages_pdf_latex_related>>
- # <<shell_packages_xml_and_epub_related>>
- ]
- )];
+ buildInputs = with pkgs; [
+ <<shell_packages_nix_related>>
+ <<shell_packages_d_build_related>>
+ <<shell_packages_candy>>
+ # <<shell_packages_search_related_sqlite>>
+ # <<shell_packages_pdf_latex_related>>
+ # <<shell_packages_xml_and_epub_related>>
+ ];
shellHook = ''
if [[ -e ".envrc" ]]; then
source .envrc
fi
+ eval "$(starship init bash)"
'';
}
#+END_SRC
@@ -546,11 +550,20 @@ ldc
#meson
#+END_SRC
+***** packages candy
+
+#+NAME: shell_packages_candy
+#+BEGIN_SRC nix
+# candy
+starship
+#+END_SRC
+
***** packages search sqlite related
-#+NAME: shell_packages_search_sqlite_related
+#+NAME: shell_packages_search_related_sqlite
#+BEGIN_SRC nix
# search_sqlite_related
+# search related
sqlite
#+END_SRC
@@ -712,16 +725,12 @@ mkDubDerivation rec {
name = "spine-${version}";
version = "<<spine_version_set>>";
src = ./.;
- buildInputs = [
- pkgs.sqlite (
- with pkgs; [
- nixFlakes
- rund
- dub
- ldc
- sqlite
- ]
- )
+ buildInputs = with pkgs; [
+ nixFlakes
+ rund
+ dub
+ ldc
+ sqlite
];
# buildPhase = [ ];
installPhase = ''
@@ -859,6 +868,10 @@ git
#+HEADER: :tangle "../sundry/spine_search_cgi/.envrc"
#+BEGIN_SRC sh
NIX_ENFORCE_PURITY=0
+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 .envrc-local ]; then # source an additional user-specific .envrc in ./.envrc-local
source .envrc-local
fi
@@ -871,10 +884,10 @@ fi
export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos
#export NIX_PATH=nixpkgs=/nixpkgs-ra/nixpkgs
# reload when these files change
-watch_file flake.nix
+# watch_file flake.nix
# watch_file flake.lock
## load the flake devShell
-eval "$(nix print-dev-env)"
+# eval "$(nix print-dev-env)"
# echo $NIX_BUILD_TOP
export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g')
export SpineSRC=<<project_path_local_src>>
@@ -882,17 +895,17 @@ export SpineBIN=<<project_path_local_bin>>
export SpineDOC=<<project_path_local_doc>>
export SpinePOD=$SpineDOC/markup/pod
#export SpineOUTversioned=<<project_path_local_out>>
-export SpineOUTstatic=<<project_path_local_out_static>>
+export SpineOUT=<<project_path_local_out_static>>
export SpineCgiBIN=<<project_path_cgi_bin>>
echo '-*- mode: org -*-
,* nixpkgs path?
- eval "$(nix print-dev-env)"
-' > nix_note_.org
+ # eval "$(nix print-dev-env)"
+' > nixNote_.org
-echo " <nixpkgs> == `nix-instantiate --find-file nixpkgs`" >> nix_note_.org
+echo " <nixpkgs> == `nix-instantiate --find-file nixpkgs`" >> nixNote_.org
echo '
,* nix build and show derivation
@@ -916,12 +929,12 @@ nix search --json 2>/dev/null |jq
,* version and build info
-,#+BEGIN_SRC sh' >> nix_note_.org
+,#+BEGIN_SRC sh' >> nixNote_.org
-echo 'spine version (git) == $SpineVER' >> nix_note_.org
-echo "spine version (git) == $SpineVER" >> nix_note_.org
-echo 'nix-instantiate == `nix-instantiate`' >> nix_note_.org
-echo "nix-instantiate == `nix-instantiate`" >> nix_note_.org
+echo 'spine version (git) == $SpineVER' >> nixNote_.org
+echo "spine version (git) == $SpineVER" >> nixNote_.org
+echo 'nix-instantiate == `nix-instantiate`' >> nixNote_.org
+echo "nix-instantiate == `nix-instantiate`" >> nixNote_.org
echo "#+END_SRC
@@ -933,10 +946,10 @@ SpineBIN=$SpineBIN
SpineDOC=$SpineDOC
SpinePOD=$SpinePOD
#SpineOUTversioned=$SpineOUTversioned
-SpineOUTstatic=$SpineOUTstatic
+SpineOUT=$SpineOUT
SpineCgiBIN=$SpineCgiBIN
,#+END_SRC
-" >> nix_note_.org
+" >> nixNote_.org
echo '* cgi form spine_search nix build and copy to spine-search
@@ -945,7 +958,7 @@ nix-build && sudo cp -vi result/share/cgi-bin/spine_search $SpineCgiBIN/.
,#+END_SRC
,* spine run instruction examples
-,** cgi operations (output to $SpineOUTstatic)
+,** cgi operations (output to $SpineOUT)
,*** configuration
,#+BEGIN_SRC sh
@@ -955,46 +968,46 @@ $SpineBIN/spine -v --show-config --config=$SpinePOD/.dr
,*** generate html (linked to search form & curate)
,#+BEGIN_SRC sh
-$SpineBIN/spine -v --html --html-link-search --html-link-curate --sqlite-db-filename="<<spine_search_db>>" --cgi-sqlite-search-filename="<<spine_search_cgi>>"--output=$SpineOUTstatic $SpinePOD/*
+$SpineBIN/spine -v --html --html-link-search --html-link-curate --sqlite-db-filename="<<spine_search_db>>" --cgi-sqlite-search-filename="<<spine_search_cgi>>"--output=$SpineOUT $SpinePOD/*
,#+END_SRC
,*** generate sql output
,#+BEGIN_SRC sh
-SpineBIN/spine -v --sqlite-update --sqlite-db-filename="<<spine_search_db>>" --output=$SpineOUTstatic $SpinePOD/*
+SpineBIN/spine -v --sqlite-update --sqlite-db-filename="<<spine_search_db>>" --output=$SpineOUT $SpinePOD/*
,#+END_SRC
,*** generate curate
,#+BEGIN_SRC sh
-$SpineBIN/spine -v --curate --output=$SpineOUTstatic $SpinePOD/*
-$SpineBIN/spine -v --html --html-link-curate --curate --output=$SpineOUTstatic $SpinePOD/*
+$SpineBIN/spine -v --curate --output=$SpineOUT $SpinePOD/*
+$SpineBIN/spine -v --html --html-link-curate --curate --output=$SpineOUT $SpinePOD/*
,#+END_SRC
,*** create or re-create sql db (--sqlite-db-create or --sqlite-db-recreate)
,#+BEGIN_SRC sh
-$SpineBIN/spine -v --sqlite-db-recreate --sqlite-db-filename="<<spine_search_db>>" --output="$SpineOUTstatic"
+$SpineBIN/spine -v --sqlite-db-recreate --sqlite-db-filename="<<spine_search_db>>" --output="$SpineOUT"
,#+END_SRC
,*** generate html (linked to search form), sql output, curate
,#+BEGIN_SRC sh
-$SpineBIN/spine -v --html --html-link-search --html-link-curate --curate --sqlite-db-filename="<<spine_search_db>>" --cgi-sqlite-search-filename="<<spine_search_cgi>>" --sqlite-update --output=$SpineOUTstatic $SpinePOD/*
+$SpineBIN/spine -v --html --html-link-search --html-link-curate --curate --sqlite-db-filename="<<spine_search_db>>" --cgi-sqlite-search-filename="<<spine_search_cgi>>" --sqlite-update --output=$SpineOUT $SpinePOD/*
,#+END_SRC
,*** make search form
,#+BEGIN_SRC sh
$SpineBIN/spine -v --cgi-search-form-codegen --config=$SpinePOD/.dr/config_local_site
-#$SpineBIN/spine -v --cgi-search-form-codegen --output=$SpineOUTstatic $SpinePOD/*
+#$SpineBIN/spine -v --cgi-search-form-codegen --output=$SpineOUT $SpinePOD/*
,#+END_SRC
-' >> nix_note_.org
+' >> nixNote_.org
-cat nix_note_.org
+#cat nixNote_.org
-echo "emacs nix_note_.org"
-echo "cat nix_note_.org"
+#echo "emacs nixNote_.org"
+#echo "cat nixNote_.org"
#+END_SRC
*** flake :flake:
@@ -1041,21 +1054,17 @@ nix flake update
pkgs.mkShell {
buildInputs = with pkgs; [(
with pkgs; [
- nixFlakes
- rund
- dub
- ldc
- sqlite
- nix-prefetch-git
- validatePkgConfig
- jq
- git
+ <<shell_packages_nix_related>>
+ <<shell_packages_d_build_related>>
+ <<shell_packages_search_related_sqlite>>
+ <<shell_packages_candy>>
]
)];
shellHook = ''
if [[ -e ".envrc" ]]; then
source .envrc
fi
+ eval "$(starship init bash)"
'';
}
#+END_SRC
@@ -1255,7 +1264,7 @@ nixpkgs=<<nixpkgs_path_local>>
#+NAME: project_path_local_out_static
#+BEGIN_SRC nix
-/srv/www/spine/static
+/srv/www/spine
#+END_SRC
#+NAME: project_path_local_out_static_
@@ -1334,7 +1343,7 @@ pkgs.mkShell {
nix-shell --run 'which xetex'
echo 'for texfile in *.tex; do echo "* --> " ~ $texfile && xelatex -interaction=batchmode $texfile; rm *.aux *.log *.toc *.out; done'
-$SpineBIN/spine --latex --serial --output="$SpineOUTstatic" $SpinePOD/* && for texfile in $SpineOUTstatic/latex/*.tex; do xelatex -interaction=nonstopmode $texfile; done 2>&1 | tee _err.xelatex_.org; ls $SpineOUTstatic/latex/*.{tex,pdf}
+$SpineBIN/spine --latex --serial --output="$SpineOUT" $SpinePOD/* && for texfile in $SpineOUT/latex/*.tex; do xelatex -interaction=nonstopmode $texfile; done 2>&1 | tee _err.xelatex_.org; ls $SpineOUT/latex/*.{tex,pdf}
/run/current-system/sw/share/X11/fonts/