-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
100 lines (87 loc) · 2.98 KB
/
justfile
File metadata and controls
100 lines (87 loc) · 2.98 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
94
95
96
97
98
99
100
# `just system`
default:
@just system
# apply current system config
system:
#!/usr/bin/env nu
let hostname = (hostname)
# start: pin devshell to gc-roots
let gc_root_name = "result-system-devshell"
let devshell_job = job spawn {
let system = (nix eval --raw --impure --expr "builtins.currentSystem")
nix build $".#devShells.($system).default" --out-link $gc_root_name
}
match (uname | get kernel-name) {
"Darwin" => {
morlana switch --flake . --no-confirm -- --show-trace --out-link result
}
"Linux" => {
nh os switch . -o result -- --show-trace
}
_ => {
error make { msg: "Unknown OS" }
}
}
# Update result-{hostname} to match result
if ("result" | path exists) {
ln -sfn (readlink result) $"result-($hostname)"
}
# cleanup: pin devshell to gc-roots
while (job list | where id == $devshell_job | length) == 1 {
print "Waiting for devshell job to finish..."
sleep 1sec
}
(ln -sfn $"(pwd)/($gc_root_name)"
$"/nix/var/nix/gcroots/per-user/($env.USER)/($gc_root_name)")
# fix the lockfile for auto-follow
lock:
direnv deny
nix flake lock
nom-run ../nix-auto-follow -- -i --consolidate
nom-run ../nix-auto-follow -- -c
direnv allow
# update all inputs
update:
nix flake update
# update input nixpkgs-bleeding
bleed:
nix flake update nixpkgs-bleeding
just lock
# build praesidium nixos configuration with gc root (useful for remote builds on nox)
build-praesidium:
nom build .#nixosConfigurations.praesidium.config.system.build.toplevel --out-link result-praesidium
@mkdir -p /nix/var/nix/gcroots/per-user/$USER
@ln -sfn $(pwd)/result-praesidium /nix/var/nix/gcroots/per-user/$USER/result-praesidium
@echo "Built and created GC root: /nix/var/nix/gcroots/per-user/$USER/result-praesidium -> $(pwd)/result-praesidium"
# build nox darwin configuration with gc root (useful for remote builds on praesidium)
build-nox:
nom build .#darwinConfigurations.nox.config.system.build.toplevel --out-link result-nox
@mkdir -p /nix/var/nix/gcroots/per-user/$USER
@ln -sfn $(pwd)/result-nox /nix/var/nix/gcroots/per-user/$USER/result-nox
@echo "Built and created GC root: /nix/var/nix/gcroots/per-user/$USER/result-nox -> $(pwd)/result-nox"
# pretty-print outputs
show:
#!/usr/bin/env nu
(nom-run github:DeterminateSystems/nix-src/flake-schemas --
flake show .)
# flake check current system
check:
#!/usr/bin/env nu
match (uname | get kernel-name) {
"Darwin" => {
# https://github.com/NixOS/nix/issues/4265#issuecomment-2477954746
(nix flake check
--override-input systems github:nix-systems/aarch64-darwin)
}
"Linux" => {
nix flake check
}
_ => {
error make { msg: "Unknown OS" }
}
}
# flake check all systems
check-all:
#!/usr/bin/env nu
(NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1
nix flake check --impure --all-systems)