-
Notifications
You must be signed in to change notification settings - Fork 3
/
justfile
53 lines (41 loc) · 1.49 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
# Build the system config and switch to it when running `just` with no args
default: switch
hostname := `hostname | cut -d "." -f 1`
### macos
# Build the nix-darwin system configuration without switching to it
[macos]
build target_host=hostname flags="":
@echo "Building nix-darwin config..."
nix --extra-experimental-features 'nix-command flakes' build ".#darwinConfigurations.{{target_host}}.system" {{flags}}
# Build the nix-darwin config with the --show-trace flag set
[macos]
trace target_host=hostname: (build target_host "--show-trace")
# Build the nix-darwin configuration and switch to it
[macos]
switch target_host=hostname: (build target_host)
@echo "switching to new config for {{target_host}}"
./result/sw/bin/darwin-rebuild switch --flake ".#{{target_host}}"
### linux
# Build the NixOS configuration without switching to it
[linux]
build target_host=hostname flags="":
nixos-rebuild build --flake .#{{target_host}} {{flags}}
# Build the NixOS config with the --show-trace flag set
[linux]
trace target_host=hostname: (build target_host "--show-trace")
# Build the NixOS configuration and switch to it.
[linux]
switch target_host=hostname:
sudo nixos-rebuild switch --flake .#{{target_host}}
## colmena
cbuild:
colmena build
capply:
colmena apply
# Update flake inputs to their latest revisions
update:
nix flake update
# Garbage collect old OS generations and remove stale packages from the nix store
gc generations="5":
nix-env --delete-generations {{generations}}
nix-store --gc