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.org361
1 files changed, 0 insertions, 361 deletions
diff --git a/org/config_nix.org b/org/config_nix.org
index 8286b05..7bd1645 100644
--- a/org/config_nix.org
+++ b/org/config_nix.org
@@ -1245,367 +1245,6 @@ jq
git
#+END_SRC
-** spine search cgi (in ./sundry)
-*** envrc :envrc:
-**** .envrc
-
-#+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 [ -f .envrc-local ]; then
- source_env_if_exists .envrc-local || source .envrc-local
-fi
-#+END_SRC
-
-**** .envrc-local
-
-#+HEADER: :tangle "../sundry/spine_search_cgi/.envrc-local_"
-#+HEADER: :noweb yes
-#+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
-## 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 SpinePROJ=<<project_path_local_project>>
-export SpineSRC=<<project_path_local_src>>
-export SpineBIN=<<project_path_local_bin>>
-export SpineDOC=<<project_path_local_doc>>
-export SpinePOD=$SpineDOC/markup/pod
-#export SpineOUTversioned=<<project_path_local_out>>
-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 ./.envrc-local
- source .env/echo-nixNote
-fi
-#+END_SRC
-
-**** .envrc-local
-
-#+HEADER: :tangle "../sundry/spine_search_cgi/.env/echo-nixNote"
-#+BEGIN_SRC sh
-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 --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`
-
-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_cgi>>"--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_cgi>>" --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"
-#+END_SRC
-
-*** flake :flake:
-
-- flake.nix
-
-nix develop
-
-nix flake update
-
-#+HEADER: :tangle "../sundry/spine_search_cgi/flake.nix"
-#+HEADER: :noweb yes
-#+BEGIN_SRC nix
-{
- description = "a sisu like document parser search form";
- inputs = {
- flake-utils.url = "github:numtide/flake-utils";
- nixpkgs.url = "<<nixpkgs_url>>";
- };
- outputs = { self, nixpkgs, flake-utils }:
- let
- pkgs = nixpkgs.legacyPackages.x86_64-linux;
- in {
- packages.x86_64-linux.spine = pkgs.stdenv.mkDerivation {
- name = "spine_search";
- inherit self;
- src = self;
- shell = ./shell.nix;
- installPhase = ''
- install -m755 -D spine_search $out/share/cgi-bin/spine_search
- '';
- };
- defaultPackage.x86_64-linux = self.packages.x86_64-linux.spine;
- };
-}
-#+END_SRC
-
-*** shell.nix :shell:
-
-#+HEADER: :tangle "../sundry/spine_search_cgi/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_tool_download>>
- <<shell_packages_candy>>
- ];
- shellHook = ''
- if [[ -f ".envrc" ]]; then
- source .envrc
- fi
- '';
-}
-#+END_SRC
-
-*** default.nix :default:
-
-#+HEADER: :tangle "../sundry/spine_search_cgi/default.nix"
-#+HEADER: :tangle-mode (identity #o755)
-#+HEADER: :shebang "#!/usr/bin/env -S nix-build"
-#+BEGIN_SRC nix
-{ pkgs ? import <nixpkgs> {} }:
-pkgs.callPackage ./derivation.nix {}
-#+END_SRC
-
-*** derivation.nix :derivation:
-
-#+HEADER: :tangle "../sundry/spine_search_cgi/derivation.nix"
-#+HEADER: :tangle-mode (identity #o644)
-#+HEADER: :noweb yes
-#+BEGIN_SRC nix
-{ pkgs ? import <nixpkgs> {},
- stdenv ? pkgs.stdenv,
- lib ? pkgs.lib,
- ldc ? null,
- dcompiler ? pkgs.ldc,
- dub ? pkgs.dub
-}:
-assert dcompiler != null;
-with (
- assert dcompiler != null;
- with lib;
- let
- # Filter function to remove the .dub package folder from src
- filterDub = name: type: let baseName = baseNameOf (toString name); in ! (
- type == "directory" && baseName == ".dub"
- );
- targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}";
- # Remove reference to build tools and library sources
- disallowedReferences = deps: [ dcompiler dub ];
- removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}'';
- in {
- mkDubDerivation = lib.makeOverridable ({
- src,
- nativeBuildInputs ? [],
- dubJSON ? src + "/dub.json",
- passthru ? {},
- package ? lib.importJSON dubJSON,
- ...
- } @ attrs: stdenv.mkDerivation (attrs // {
- pname = package.name;
- nativeBuildInputs = [ dcompiler dub pkgs.removeReferencesTo ] ++ nativeBuildInputs;
- disallowedReferences = disallowedReferences deps;
- passthru = passthru // {
- inherit dub dcompiler pkgs;
- };
- src = lib.cleanSourceWith {
- filter = filterDub;
- src = lib.cleanSource src;
- };
- preFixup = ''
- find $out/share/cgi-bin -type f -exec ${removeExpr (disallowedReferences deps)} '{}' + || true
- '';
- buildPhase = ''
- runHook preBuild
- export HOME=$PWD
- for dc_ in dmd ldmd2 gdmd; do
- echo "- check for D compiler $dc_"
- dc=$(type -P $dc_ || echo "")
- if [ ! "$dc" == "" ]; then
- break
- fi
- done
- if [ "$dc" == "" ]; then
- exit "Error: could not find D compiler"
- fi
- echo "$dc_ used as D compiler to build $pname"
- dub build --compiler=$dc --build=release --combined --skip-registry=all
- runHook postBuild
- '';
- checkPhase = ''
- runHook preCheck
- export HOME=$PWD
- dub test --combined --skip-registry=all
- runHook postCheck
- '';
- installPhase = ''
- runHook preInstall
- mkdir -p $out/share/cgi-bin
- cp -r "${targetOf package}" $out/share/cgi-bin
- install -m755 -D $out/share/cgi-bin/spine_search spine_search
- runHook postInstall
- '';
- postInstall = ''
- echo "HERE ${targetOf package} $out/share/cgi-bin"
- echo `ls -la $out/share/cgi-bin/spine_search`
- '';
- meta = lib.optionalAttrs (package ? description) {
- description = package.description;
- } // attrs.meta or {};
- } // lib.optionalAttrs (!(attrs ? version)) {
- name = package.name; # use name from dub.json, unless pname and version are specified
- }));
- }
-);
-mkDubDerivation rec {
- name = "spine-search-${version}";
- version = "<<spine_version_set>>";
- src = ./.;
- buildInputs = [
- pkgs.sqlite (
- with pkgs; [
- nixVersions.unstable #nixFlakes
- ## package manager
- dub
- ## compiler
- ldc
- rund
- ## linker
- #lld
- #mold
- ## builder
- #ninja
- sqlite
- ]
- )
- ];
- meta = with pkgs.lib; {
- pname = "spine-search";
- version = "<<spine_version_set>>";
- homepage = "https://sisudoc.org";
- description = "cgi sqlite search form for document object search";
- longDescription = ''
- A sisu like parser and document generator
- ...
- '';
- license = licenses.agpl3Plus;
- platforms = platforms.linux;
- maintainers = [ "RalphAmissah" ];
- };
-}
-#+END_SRC
-
** variables
*** spine version SET VERSION :version:set:project: