forked from BastianAsmussen/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
71 lines (60 loc) · 1.78 KB
/
justfile
File metadata and controls
71 lines (60 loc) · 1.78 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
[private]
default:
@just --list
# Run a flake check on the config.
[group("checks")]
check ARGS="":
nix flake check \
--keep-going \
--show-trace \
{{ ARGS }}
# Rebuild and switch to the specified host (defaults to current hostname).
[group("building")]
rebuild HOST=`hostname`:
nh os switch --hostname {{ HOST }} .
# Rebuild and switch, updating all flake inputs first.
[group("building")]
upgrade HOST=`hostname`:
just update
just rebuild {{ HOST }}
# Clean up NixOS generations.
[group("building")]
clean:
nh clean all --keep-since 7d --keep 3
# Update all flake inputs (or a specific one).
[group("update")]
update *INPUT:
nix flake update {{ INPUT }}
# Format all Nix files.
[group("checks")]
fmt:
nix fmt .
# Set up disks for a host using disko (DESTRUCTIVE - destroys existing data!).
[group("install")]
disko HOST:
sudo nix run github:nix-community/disko/latest \
--experimental-features 'nix-command flakes' -- \
--mode destroy,format,mount \
modules/nixosModules/hosts/{{ HOST }}/disko-config.nix
# Install NixOS for the specified host (run after disko).
[group("install")]
install HOST:
sudo nixos-install --flake .#{{ HOST }}
# Build a custom ISO image.
[group("building")]
iso:
rm -rf result
nix build .#nixosConfigurations.iso.config.system.build.isoImage --impure
ln -sf result/iso/*.iso latest.iso
# Write the latest ISO to a flash drive.
[group("building")]
iso-install DRIVE:
just iso
sudo dd if=latest.iso of={{ DRIVE }} bs=4M status=progress oflag=sync
# Generate the topology diagram and move it to `docs/`.
[group("building")]
topology:
mkdir -p docs/
rm -f docs/topology.svg
nix build .#topology.x86_64-linux.config.output
cp result/main.svg docs/topology.svg