-
Notifications
You must be signed in to change notification settings - Fork 4
/
utils.nu
44 lines (38 loc) · 1.21 KB
/
utils.nu
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
# ================= NixOS related =========================
export def nixos-switch [
name: string
mode: string
] {
if "debug" == $mode {
# show details via nix-output-monitor
nom build $".#nixosConfigurations.($name).config.system.build.toplevel" --show-trace --verbose
nixos-rebuild switch --use-remote-sudo --flake $".#($name)" --show-trace --verbose
} else {
nixos-rebuild switch --use-remote-sudo --flake $".#($name)"
}
}
# ================= macOS related =========================
export def darwin-build [
name: string
mode: string
] {
let target = $".#darwinConfigurations.($name).system"
if "debug" == $mode {
nom build $target --extra-experimental-features "nix-command flakes" --show-trace --verbose
} else {
nix build $target --extra-experimental-features "nix-command flakes"
}
}
export def darwin-switch [
name: string
mode: string
] {
if "debug" == $mode {
./result/sw/bin/darwin-rebuild switch --flake $".#($name)" --show-trace --verbose
} else {
./result/sw/bin/darwin-rebuild switch --flake $".#($name)"
}
}
export def darwin-rollback [] {
./result/sw/bin/darwin-rebuild --rollback
}