-*- mode: org -*- #+TITLE: configuration nix #+DESCRIPTION: configuration nix #+FILETAGS: :sisu:build:tools: #+AUTHOR: Ralph Amissah #+EMAIL: [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]] #+COPYRIGHT: Copyright (C) 2015 - 2025 Ralph Amissah #+LANGUAGE: en #+STARTUP: content hideblocks hidestars noindent entitiespretty #+PROPERTY: header-args :exports code #+PROPERTY: header-args+ :noweb yes #+PROPERTY: header-args+ :results no #+PROPERTY: header-args+ :cache no #+PROPERTY: header-args+ :padline no #+PROPERTY: header-args+ :mkdirp yes #+OPTIONS: H:3 num:nil toc:t \n:t ::t |:t ^:nil -:t f:t *:t * nix :nix: #+NAME: nixpkgs_local #+BEGIN_SRC sh /srv/nix/nixpkgs #+END_SRC * sisu - default.nix - shell.nix ** flake.nix #+HEADER: :tangle ../flake.nix #+HEADER: :noweb yes #+BEGIN_SRC nix { description = "sisu parser & document generator"; inputs.nixpkgs.url = "<>"; inputs.sisu.url = "git://git.sisudoc.org/software/sisu"; #git clone git://git.sisudoc.org/software/sisu inputs.sisu.inputs.nixpkgs.follows = "nixpkgs"; inputs.sisu.flake = true; outputs = { self, nixpkgs, sisu } @ inputs: let version = "<>"; shell = ./shell.nix; # ./default.nix; devEnv = ./.envrc; # ./.envrc; # ./shell.nix; # ./default.nix; supportedSystems = [ "x86_64-linux" ]; # [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); # nixpkgs instantiated for supported system types. in { packages = forAllSystems (system: let pkgs = nixpkgsFor.${system}; in { default = sisu.packages.${system}.default; #vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000="; }); apps = forAllSystems (system: { default = { type = "app"; program = "${self.packages.${system}.default}/bin/sisu"; }; }); devShells = forAllSystems (system: let pkgs = nixpkgsFor.${system}; shellHook = '' export Date=`date "+%Y%m%d"` ### set local values in .envrc-local (or modify here if you must) # export sisuPROJ=~/grotto/repo/git.repo/projects/doc-reform/code/software/sisu # export sisuDOC=~/grotto/repo/git.repo/projects/project-sisu/doc-reform-markup/sisu-markup-samples # export sisu=/srv/www/sisu # export sisu=/var/www/sqlite # export sisu=/srv/www/sisu/sqlite export sisu=$sisuPROJ/src export sisu=$sisuPROJ/result/lib export sisu=$sisuDOC/markup/pod export sisu=$sisuOUT/$sisuVER export sisu='http://localhost/sisu_search' # export sisuSearchActionRemote='https://sisudoc.org/sisu_search' export sisuCGIform='sisu_search' export sisuSQLdb='sisusearch.db' export PROG_VER_GIT="`git describe --long --tags | sed -e 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g'`" export sisuNixHelp="cat ./.env/nix-commands" export sisuTest="nix shell .#default --print-build-logs --command sisu --very-verbose --epub --html --html-link-search --html-link-curate --curate --output=\"\$sisuOUT\" $sisuPOD/*" export sisuHtml="sisu --very-verbose --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename=\"sisu.search.db\" --cgi-sqlite-search-filename=\"sisu_search\" --sqlite-db-path=\"\$sisuDBpath\" --output=\"\$sisuOUT\" $sisuPOD/*" export sisuEpub="sisu --very-verbose --epub --output=\"\$sisuOUT\" $sisuPOD/*" export sisuLatex="sisu --very-verbose --latex --output=\"\$sisuOUT\" $sisuPOD/*" export sisuPdf="sisu --very-verbose --pdf --output=\"\$sisuOUT\" $sisuPOD/*" export sisuSqliteCreateDB="sisu --very-verbose --sqlite-db-recreate --sqlite-db-path=\"$sisuDBpath\" --sqlite-db-filename=\"sisu.search.db\"" export sisuSqlite="sisu --very-verbose --sqlite-discrete --sqlite-db-path=\"$sisuDBpath\" --sqlite-db-filename=\"sisu.search.db\" --output=\"\$sisuOUT\" $sisuPOD/*" #export sisuSqlite="sisu --very-verbose --sqlite-update --sqlite-db-path=\"$sisuDBpath\" --sqlite-db-filename=\"sisu.search.db\" --output=\"\$sisuOUT\" $sisuPOD/*" ''; in with pkgs; { dsh = mkShell { name = "sisu dev base shell"; inherit shell; inherit devEnv; packages = [ <> sqlite jq git ]; inherit shellHook; }; dsh-epub = mkShell { name = "sisu dev shell for epub output"; inherit shell; inherit devEnv; packages = [ <> sqlite graphicsmagick zip unzip xz libxml2 html-tidy xmlstarlet epubcheck ebook_tools libxml2 html-tidy xmlstarlet epubcheck ebook_tools epr sigil calibre #(suite includes: ebook-viewer) foliate validatePkgConfig jq git ]; inherit shellHook; }; dsh-html = mkShell { name = "sisu dev shell for html output"; inherit shell; inherit devEnv; packages = [ <> sqlite graphicsmagick zip unzip xz validatePkgConfig jq git ]; inherit shellHook; }; dsh-latex-pdf = mkShell { name = "sisu dev shell for latex & pdf output"; inherit shell; inherit devEnv; packages = [ <> sqlite graphicsmagick zip unzip xz source-sans-pro source-serif-pro source-code-pro texliveFull # texliveTeTeX noto-fonts noto-fonts-cjk-sans takao validatePkgConfig jq git ]; inherit shellHook; }; dsh-sqlite = mkShell { name = "sisu dev shell for sqlite3 output"; inherit shell; inherit devEnv; packages = [ <> sqlite graphicsmagick zip unzip xz validatePkgConfig jq git ]; inherit shellHook; }; dsh-i18n = mkShell { name = "sisu dev shell internationalization, po4a"; inherit shell; inherit devEnv; packages = [ <> sqlite graphicsmagick perl538Packages.Po4a validatePkgConfig jq git ]; inherit shellHook; }; default = import ./shell.nix { inherit pkgs; }; }); }; } #+END_SRC *** flake :flake: **** flake parts ***** ruby version #+NAME: ruby_current #+BEGIN_SRC shell ruby<> rubyPackages<>.rake rubyPackages<>.sqlite3 rubyPackages<>.thor #+END_SRC #+NAME: ruby_version #+BEGIN_SRC shell _3_4 #+END_SRC ** shell.nix :shell: *** tangle #+HEADER: :tangle ../shell.nix #+HEADER: :tangle-mode (identity #o755) #+HEADER: :shebang "#!/usr/bin/env -S nix-shell --pure\n#!nix-shell -i bash" #+HEADER: :noweb yes #+BEGIN_SRC nix { pkgs ? import {} }: let in pkgs.mkShell { buildInputs = with pkgs; [ nix bundler bundix #ruby #rubyPackages.rake #rubyPackages.sqlite3 #rubyPackages.thor <> sqlite graphicsmagick unzip xz zip #texliveFull # texliveTeTeX ]; } #+END_SRC **** shell parts (packages) ***** packages nix related #+NAME: shell_packages_nix_related #+BEGIN_SRC nix ### nix_related direnv nixVersions.unstable #nixFlakes nix-prefetch-git validatePkgConfig jq git ps #+END_SRC ** variables *** sisu version SET VERSION :version:set:project: #+NAME: sisu_version_set #+BEGIN_SRC sh 0.7.3 #+END_SRC *** set names SET #+NAME: sisu_search_db #+BEGIN_SRC sh sisu.search.db #+END_SRC #+NAME: sisu_search_cgi #+BEGIN_SRC sh sisu_search #+END_SRC *** nixpkgs_path SETUP **** nixpkgs select path SELECT #+NAME: nixpkgs_path #+HEADER: :noweb yes #+BEGIN_SRC nix <> #+END_SRC **** nixpkgs path options - #+NAME: nixpkgs_path_default #+HEADER: :noweb yes #+BEGIN_SRC nix #+END_SRC #+NAME: nix_path_directory #+HEADER: :noweb yes #+BEGIN_SRC nix nixpkgs=<> #+END_SRC #+NAME: project_path_local_project #+HEADER: :noweb yes #+BEGIN_SRC nix ~/grotto/repo/git.repo/projects/project-sisu/sisu #+END_SRC #+NAME: project_path_local_src #+HEADER: :noweb yes #+BEGIN_SRC nix <>/lib #+END_SRC #+NAME: project_path_local_bin #+HEADER: :noweb yes #+BEGIN_SRC nix <>/result/bin #+END_SRC #+NAME: project_path_cgi_bin #+BEGIN_SRC nix /var/www/cgi/cgi-bin #+END_SRC #+NAME: project_path_local_doc #+BEGIN_SRC nix ~/grotto/repo/git.repo/projects/project-sisu/sisu-markup/sisu-markup-samples #+END_SRC #+NAME: project_path_local_out #+BEGIN_SRC nix /srv/www/sisu #+END_SRC #+NAME: project_path_local_out_ #+HEADER: :noweb yes #+BEGIN_SRC nix /tmp/sisu/$SisuVER/www #+END_SRC #+NAME: project_path_local_out_static #+HEADER: :noweb yes #+BEGIN_SRC nix /srv/www/sisu #+END_SRC #+NAME: project_path_local_out_static_ #+BEGIN_SRC nix /var/www #+END_SRC #+NAME: project_path_sqlite #+BEGIN_SRC nix /var/www/sqlite #+END_SRC #+NAME: nixpkgs_url #+BEGIN_SRC nix github:NixOS/nixpkgs/nixpkgs-unstable #+END_SRC #+BEGIN_SRC nix github:nixos/nixpkgs #+END_SRC #+HEADER: :noweb yes #+BEGIN_SRC nix <> #+END_SRC - local path SET WARN #+NAME: nixpkgs_path_local #+BEGIN_SRC nix /srv/nix/nixpkgs #+END_SRC ** texlive xetex xelatex shell.nix *** shell.nix :shell: #+BEGIN_SRC nix #!/usr/bin/env -S nix-shell --pure { pkgs ? import {} }: pkgs.mkShell { buildInputs = with pkgs; [ nixVersions.unstable #nixFlakes nix-prefetch-git validatePkgConfig jq git fontconfig source-sans-pro source-serif-pro source-code-pro #(texlive.combine { # inherit (texlive) scheme-tetex xetex fontspec footmisc multirow titlesec listings anysize float graphics helvetic times courier; #}) texliveFull # texliveTeTeX dejavu_fonts dejavu_fontsEnv liberation_ttf evince zathura apvlv ]; #FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ # liberation_ttf #]; shellHook = '' if [[ -f ".envrc" ]]; then source .envrc fi #for texfile in *.tex; do xelatex -interaction=nonstopmode $texfile; done #for texfile in *.tex; do xelatex -interaction=batchmode $texfile; done ''; } #+END_SRC