aboutsummaryrefslogtreecommitdiffhomepage
path: root/sundry/spine_search_cgi/.envrc-local_
blob: 440b597364a2ee0baafe9306270d75bcbe971e1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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.lock
## load the flake devShell
# 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=/grotto-ra/repo/git.repo/projects/project-spine/doc-reform
export SpineBIN=/grotto-ra/repo/git.repo/projects/project-spine/doc-reform/result/bin
export SpineDOC=/grotto-ra/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples
export SpinePOD=$SpineDOC/markup/pod
#export SpineOUTversioned=/srv/www/spine/$SpineVER
export SpineOUT=/srv/www/spine
export SpineDBpath=/var/www/sqlite
export SpineCgiBIN=/var/www/cgi/cgi-bin

echo '-*- mode: org -*-

* nixpkgs path?

  # eval "$(nix print-dev-env)"
' > nixNote_.org

echo "  <nixpkgs> == `nix-instantiate --find-file nixpkgs`" >> nixNote_.org

echo '
* nix build and show derivation

#+BEGIN_SRC sh
nix-shell --pure

nix-build
nix build -f default.nix
nix shell -f default.nix
nix-instantiate | nix-build
nix build `nix-instantiate`

nix develop

nix-instantiate | nix show-derivation | jq
nix-instantiate | nix show-derivation --recursive | jq

nix search --json 2>/dev/null |jq
#+END_SRC

* version and build info

#+BEGIN_SRC sh' >> nixNote_.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

* initialised shell variables

#+BEGIN_SRC sh
SpineSRC=$SpineSRC
SpineBIN=$SpineBIN
SpineDOC=$SpineDOC
SpinePOD=$SpinePOD
#SpineOUTversioned=$SpineOUTversioned
SpineOUT=$SpineOUT
SpineCgiBIN=$SpineCgiBIN
#+END_SRC
" >> nixNote_.org

echo '* cgi form spine_search nix build and copy to spine-search

#+BEGIN_SRC sh
nix-build && sudo cp -vi result/share/cgi-bin/spine_search $SpineCgiBIN/.
#+END_SRC

* spine run instruction examples
** cgi operations (output to $SpineOUT)
*** configuration

#+BEGIN_SRC sh
$SpineBIN/spine -v --show-config --config=$SpinePOD/.dr
#+END_SRC

*** 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"--output=$SpineOUT $SpinePOD/*
#+END_SRC

*** generate sql output

#+BEGIN_SRC sh
SpineBIN/spine -v --sqlite-update --sqlite-db-filename="spine.search.db" --sqlite-db-path="$SpineDBpath"
#+END_SRC

*** generate curate

#+BEGIN_SRC sh
$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" --sqlite-db-path="$SpineDBpath"
#+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" --sqlite-update --sqlite-db-path="$SpineDBpath" --output="$SpineOUT" $SpinePOD/*
#if names and paths are configured in resource configuration file, e.g. $SpinePOD/.rc/config_local_site
$SpineBIN/spine -v --html --html-link-search --html-link-curate --curate --sqlite-update $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=$SpineOUT $SpinePOD/*
#+END_SRC
' >> nixNote_.org

#cat nixNote_.org

#echo "emacs nixNote_.org"
#echo "cat nixNote_.org"