aboutsummaryrefslogtreecommitdiffhomepage
path: root/shell.nix
diff options
context:
space:
mode:
Diffstat (limited to 'shell.nix')
-rwxr-xr-xshell.nix96
1 files changed, 56 insertions, 40 deletions
diff --git a/shell.nix b/shell.nix
index 1974340..29b6577 100755
--- a/shell.nix
+++ b/shell.nix
@@ -1,44 +1,43 @@
#!/usr/bin/env -S nix-shell --pure
#!nix-shell -i bash
-{pkgs-nix ? import <nixpkgs> {}}:
-with pkgs-nix;
+# Development environment for sisudoc-spine.
+# Builds the spine binary via ./package.nix and puts it on PATH.
+#
+# Build logic for the spine derivation lives in ./package.nix
+# this file only describes the dev shell.
+#
+# Usage:
+# nix-shell # enters shell, builds spine
+# nix-shell --run 'spine --version' # runs spine after build
+{
+ pkgs ? import <nixpkgs> {},
+ spine ? pkgs.callPackage ./package.nix {},
+ # captured at eval time - nix-shell rewrites $SHELL at runtime,
+ # so we must remember the user's real login shell here.
+ userShell ? builtins.getEnv "SHELL",
+}:
+with pkgs;
mkShell {
- buildInputs = [
+ name = "spine base dev shell";
+ packages = [
+ # ❯❯❯ spine binary built from ./package.nix
+ spine
+ # ❯❯❯ d_build_related
+ ldc
+ #dmd
+ dub
+ # ❯❯❯ dev
+ gnumake
+ git
# ❯❯❯ nix_related
- #nix
direnv
nix-direnv
- nixVersions.latest #nixVersions.latest #nixVersions.git
nix-prefetch-git
- validatePkgConfig
nix-output-monitor
nix-tree
- jq #gx
- #nixfmt-rfc-style
- git
- # ❯❯❯ dev
- gnumake
- #ps
- # ❯❯❯ d_build_related
- # ❯❯ package manager
- #dub
- # ❯❯ compiler
- #dmd
- #ldc
- #rund
- # ❯❯ linker
- #lld
- #mold
- # ❯❯ builder
- #ninja
- #meson
+ jq
# ❯❯❯ sqlite search related
- #sqlite
- # ❯❯❯ pdf_latex_related
- # source-sans-pro
- # source-serif-pro
- # source-code-pro
- # texlive.combined.scheme-full
+ sqlite
# ❯❯❯ xml_and_epub_related
# libxml2
# html-tidy
@@ -50,18 +49,35 @@ with pkgs-nix;
# calibre #(suite includes: ebook-viewer)
# koreader
# foliate
+ # ❯❯❯ pdf reader
+ # evince
+ # ❯❯❯ pdf_latex_related
+ # source-sans-pro
+ # source-serif-pro
+ # source-code-pro
+ # texlive.combined.scheme-full
# ❯❯❯ i18n translation related
# perlPackages.Po4a
- # ❯❯❯ dev
- # openssl_3_3
];
shellHook = ''
- echo '❯❯ nix build';
- SpineGitVer=`git describe | sed "s/^[a-z_-]\+\([0-9.]\+\)/\1/" | sed "s/\([^-]*-g\)/r\1/" | sed "s/-/./g"` && \
- SpineGitBranch=`git branch --show-current` && \
- echo "❯❯ spine - ($SpineGitBranch: $SpineGitVer)"
- echo '❯❯ $SpineBIN -v --source --pod --text --epub --html --html-link-pdf --html-link-curate --html-link-markup --curate --output=$SpineOUT $SpinePOD/*';
- echo "❯❯ $SpineBIN -v --source --pod --text --epub --html --html-link-pdf --html-link-curate --html-link-markup --curate --output=$SpineOUT $SpinePOD/*";
- echo '❯❯ nix flake update && nix flake check && nix flake show';
+ export DFLAGS="-O2 -boundscheck=on"
+ export Date=$(date "+%Y%m%d")
+ ## set local values in .envrc-local (or here if you must)
+ echo "spine: $(command -v spine)"
+ ## hand off to the user's login shell (e.g. zsh) only when this is
+ ## an interactive nix-shell entry - not under `nix-shell --run` or
+ ## `--command`, where exec would swallow the command. Guard env var
+ ## prevents re-entry loops.
+ __spine_user_shell=${if userShell == "" then "" else "\"" + userShell + "\""}
+ if [ -z "$__SPINE_SHELL_HANDOFF" ] \
+ && [ -n "$__spine_user_shell" ] \
+ && [ "$(basename "$__spine_user_shell")" != "bash" ] \
+ && [[ $- == *i* ]]; then
+ export __SPINE_SHELL_HANDOFF=1
+ spine --version
+ exec "$__spine_user_shell"
+ fi
+ unset __spine_user_shell
+ spine --version
'';
}