-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
89 lines (67 loc) · 2.38 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
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
# allow positional arguments to commands
set positional-arguments := true
set ignore-comments := true
# ignore comment lines in recipes
# List available recipes
_default:
@just --list --unsorted
# Rebuild system with current configuration (does not update)
switch:
sudo nixos-rebuild switch
# Rebuild system with current configuration (does not update) for next boot
switch-boot:
sudo nixos-rebuild boot
# Switch using home-manager (only)
hm-switch:
home-manager switch --flake .
# Update all flake inputs (i.e., package repos, doom-emacs version, etc.)
update:
nix flake update
# Update the packages in the current `nix profile`
update-profile:
NIXPKGS_ALLOW_UNFREE=1 nix profile upgrade '.*' --impure
# Show available inputs (can be used for `update-input`)
show-inputs:
nix flake metadata
# Update a single input (see `show-inputs` for available inputs)
update-input input:
nix flake lock --update-input '{{ input }}'
# Sync doom, sometimes necessary to do manually after updates
sync-doom:
doom sync
# Update all doom packages and sync
update-doom-packages:
doom sync -u
# Build and show what changes would be activated (i.e., services)
dry-activate:
sudo nixos-rebuild dry-activate
# Build the system configuration to `./result` (`nice`'d)
build:
nice -n 19 nixos-rebuild build
# Build the system configuration, but throttle CPU, download-speed and run nice'd.
build-throttled:
nice -n 19 nix --download-speed 1000 --max-substitution-jobs 1 build .#nixosConfigurations.$(hostname).config.system.build.toplevel
# Check the flake using `nix flake check`
check:
nix flake check
# Format everything (using `nixpkgs-fmt` and `just --fmt`).
format:
nixpkgs-fmt .
just --unstable --fmt
# Check if everything is formatted correctly.
format-check:
nixpkgs-fmt . --check
just --unstable --fmt --check
# Show a diff of changes using `nix-diff`
diff:
nix-diff /run/current-system ./result
# Nix collect garbage; dry-run
nix-gc:
nix-collect-garbage --dry-run --delete-older-than 14d
# Nix collect garbage; actual run
nix-gc-force:
nix-collect-garbage --delete-older-than 14d
# Delete ZFS snapshots older than one year (dry-run, see https://github.com/bahamas10/zfs-prune-snapshots for more, might need `sudo`)
prune-old-zfs-snapshots:
# To list them first: `zfs list -t snapshot`
nix run unstable#zfs-prune-snapshots -- -Rvn 1y