-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.nix
More file actions
93 lines (82 loc) · 2.92 KB
/
Copy pathshell.nix
File metadata and controls
93 lines (82 loc) · 2.92 KB
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
# shell.nix — project-local Nix environment for metabo.figures pipeline.
#
# Beauty is NixOS; the pipeline depends on:
# - libpq for RPostgres
# - V8 + nodejs for jsonvalidate / juicyjuice / gt
# - TeX Live (xelatex + pdfpages + fontspec + tikz + standalone)
# - pdftk for FR-029 bundle concatenation
# - graphics tooling already declared elsewhere (uv, R)
#
# Usage on beauty:
#
# cd ~/dev/metabo-usecases
# nix-shell
# # Inside the shell, the env has libpq, V8, xelatex, pdftk on PATH.
# Rscript -e 'devtools::install_deps(dependencies = TRUE)'
# ./rebuild.sh --dry-run
#
# Laptops without nix can still work — only the system deps fail to
# install in that case; the R package logic itself remains portable.
{ pkgs ? import <nixpkgs> {} }:
let
texEnv = pkgs.texlive.combine {
inherit (pkgs.texlive)
scheme-medium
pdfpages
eso-pic # required by pdfpages for page overlays
fontspec
standalone
pgf # tikz
xcolor
geometry
l3packages
multirow # required by gt's LaTeX backend (tables)
anyfontsize # required by gt's LaTeX backend (tables)
ragged2e # \justifying for caption pipeline
;
};
in
pkgs.mkShell {
name = "metabo-figures";
buildInputs = with pkgs; [
# R is intentionally NOT pinned here so we inherit the system R
# (and its user library) on beauty. Laptops without R installed
# can still run the non-R parts of the pipeline.
# Python helpers via uv (kept out of nix — uv manages its own venv).
uv
python311
# System libs for R packages that won't build without them.
postgresql.dev # libpq for RPostgres
nodejs # provides V8 for jsonvalidate / juicyjuice / gt
icu # text utilities used by stringi / R
libxml2
openssl
curl
pkg-config
# Composition + manuscript-bundle tooling.
texEnv
pdftk
poppler-utils # pdftoppm for --png PNG companions
# Quality-of-life tools used by quickstart.md / docs.
git
rsync
jq
yq-go
];
shellHook = ''
echo "[shell.nix] metabo.figures dev environment ready"
echo " R: $(R --version 2>&1 | head -1)"
echo " xelatex: $(xelatex --version 2>&1 | head -1)"
echo " pdftk: $(pdftk --version 2>&1 | head -1)"
echo " Postgres include path for RPostgres: ${pkgs.postgresql.dev}/include"
export PKG_CONFIG_PATH="${pkgs.postgresql.dev}/lib/pkgconfig:$PKG_CONFIG_PATH"
# The system R on beauty lives at /run/current-system/sw/bin/R and
# carries the user's ~/R library; prepend system PATH so it wins
# over any R we accidentally pull in transitively.
export PATH="/run/current-system/sw/bin:$PATH"
# R V8 package: tell it to fetch a static libv8 rather than look
# for a system one (nixpkgs has no top-level v8 attribute, and
# jsonvalidate / juicyjuice / gt depend on V8).
export DOWNLOAD_STATIC_LIBV8=1
'';
}