-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
64 lines (49 loc) · 1.96 KB
/
justfile
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
# friendship ended with Makefile
# I LOVE justFILE!!!!!!
# modules are unstable atm
# mod utils
# build the current configuration
build system="" +extra_args="":
nixos-rebuild -v -L build --flake .#{{system}} --keep-going --accept-flake-config \
{{extra_args}}
{{ if system == "" {"nvd diff /run/current-system result"} else {""} }}
# build and test the configuration, but don't switch
test system="":
nixos-rebuild -v -L test --flake .#{{system}} --accept-flake-config
deploy system:
nixos-rebuild switch --flake .#{{system}} --target-host {{system}} --use-remote-sudo -v -L --use-substitutes
dry-deploy system:
nixos-rebuild build --flake .#{{system}} --target-host {{system}} --use-remote-sudo -v -L --use-substitutes
# switch to the current configuration
switch system="": sudo_cache
sudo nixos-rebuild -v -L switch --flake .#{{system}} --accept-flake-config
# literally nixos-rebuild boot with a different name
defer system="": sudo_cache
sudo nixos-rebuild -v -L boot --flake .#{{system}} --accept-flake-config
# check the flake
check:
nix flake check
# delete old nixos generations and GCs the store.
gc older_than="3d": sudo_cache
sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than {{older_than}}
sudo nix store gc -vL
# run utility programs
utils recipe="list" +extras="":
@echo "Running utils/{{recipe}}"
@just -d utils -f utils/justfile {{recipe}} {{extras}}
# update an input in the flake lockfile
update-input input:
nix flake lock --update-input {{input}}
# update everything in flake.lock and commit that
flake-update:
nix flake update --commit-lock-file
# list changes in the current config vs the system config
diff:
nvd diff /run/current-system result
# build a vm for a system
vm system run="true" bootloader="false":
nixos-rebuild -v -L build-vm{{if bootloader == "true" {"-with-bootloader"} else {""} }} --flake .#{{system}}
{{if run == "true" {"./result/bin/run-"+system+"-vm"} else {""} }}
[private]
sudo_cache:
@sudo -v