Modular, context-aware and aspect-oriented dendritic Nix configurations.
Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/
den.oeiuwq.com
configurations
den
dendritic
nix
aspect
oriented
1system := `nix-instantiate --eval --raw -E builtins.currentSystem`
2
3help:
4 just -l
5
6check-all:
7 just check-noflake
8 just all check
9 just unit
10
11check-noflake:
12 nix-build ./templates/noflake --no-out-link -A flake.nixosConfigurations.igloo
13
14update-all:
15 cd templates/noflake && npins update den
16 just all update
17
18update-nix-effects:
19 cd templates/ci && nix flake update nix-effects
20
21docs:
22 cd docs && pnpm run dev
23
24ci test="" *args:
25 bash ./ci.bash "{{system}}" "{{test}}" {{args}}
26
27ci-deep test="" *args:
28 just nix-unit ci "{{test}}" {{args}}
29
30bogus *args:
31 just nix-unit bogus "bogus" {{args}}
32
33nix-unit template test *args:
34 nix-unit --override-input den . --flake ./templates/{{template}}#.tests.{{test}} {{args}}
35
36check template *args:
37 nix flake check --override-input den . ./templates/{{template}} {{args}}
38
39update template:
40 nix flake update --flake ./templates/{{template}} den
41
42all task:
43 just {{task}} minimal
44 just {{task}} example
45 just {{task}} default
46 just {{task}} ci
47 just {{task}} bogus
48 just {{task}} microvm
49 just {{task}} nvf-standalone
50 just {{task}} flake-parts-modules
51
52fmt:
53 nix run github:vic/checkmate#fmt --override-input target .
54
55unit:
56 nix flake check --override-input target . github:vic/checkmate
57
58repl:
59 nix repl --override-input den . ./templates/ci
60
61[arg("tmpdir",long="tmpdir"), arg("head",long="head",short="h"), arg("base",long="base",short="b"), arg("warm",long="warm",short="w"), arg("runs",long="runs",short="r")]
62bench tmpdir="/tmp" head="HEAD" base="refs/remotes/origin/main" warm="2" runs="5" *args:
63 rm -rf "{{tmpdir}}/den-head" "{{tmpdir}}/den-base"
64 git clone --local --depth 1 --revision "$(git rev-list -n1 {{head}})" .git "{{tmpdir}}/den-head" 2>/dev/null
65 git clone --local --depth 1 --revision "$(git rev-list -n1 {{base}})" .git "{{tmpdir}}/den-base" 2>/dev/null
66 rm -rf "{{tmpdir}}/den-base/templates/ci"
67 cp -r "{{tmpdir}}/den-head/templates/ci" "{{tmpdir}}/den-base/templates/ci"
68 pushd "{{tmpdir}}/den-base" && git add templates/ci && popd
69 hyperfine -m "{{runs}}" -w "{{warm}}" {{args}} \
70 -n head "nix-unit --override-input den {{tmpdir}}/den-head --flake {{tmpdir}}/den-head/templates/ci#.tests.performance 2>&1 | tail -1" \
71 -n base "nix-unit --override-input den {{tmpdir}}/den-base --flake {{tmpdir}}/den-base/templates/ci#.tests.performance 2>&1 | tail -1"
72 rm -rf "{{tmpdir}}/den-head" "{{tmpdir}}/den-base"