-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathjustfile
96 lines (77 loc) · 2.29 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
90
91
92
93
94
95
96
flake_var := env_var('FLAKE')
flake := if flake_var =~ '^\.*$' { justfile_directory() } else { flake_var }
[private]
default:
@just --list --unsorted
# setup our nixos builder
[group('rebuild')]
[linux]
[private]
builder goal *args:
nh os {{ goal }} -- {{ args }}
# setup our darwin builder
[group('rebuild')]
[macos]
[private]
builder goal *args:
nh darwin {{ goal }} -- {{ args }}
# we have this setup incase i ever want to go back and use the old stuff
[group('rebuild')]
[linux]
[private]
classic goal *args:
sudo nixos-rebuild {{ goal }} --flake {{ flake }} {{ args }} |& nom
# rebuild the boot
[group('rebuild')]
boot *args: (builder "boot" args)
# test what happens when you switch
[group('rebuild')]
test *args: (builder "test" args)
# switch the new system configuration
[group('rebuild')]
switch *args: (builder "switch" args)
[group('rebuild')]
[macos]
provision host:
nix run github:LnL7/nix-darwin -- switch --flake {{ flake }}#{{ host }}
sudo -i nix-env --uninstall lix # we need to remove the none declarative install of lix
# build the package, you must specify the package you want to build
[group('package')]
build pkg:
nix build {{ flake }}#{{ pkg }} --log-format internal-json -v |& nom --json
# build the iso image, you must specify the image you want to build
[group('package')]
iso image: (build "nixosConfigurations." + image + ".config.system.build.isoImage")
# build the tarball, you must specify the host you want to build
[group('package')]
tar host:
sudo nix run {{ flake }}#nixosConfigurations.{{ host }}.config.system.build.tarballBuilder
[private]
verify *args:
nix-store --verify {{ args }}
# repairs the nix store from any breakages it may have
[group('dev')]
repair: (verify "--check-contents --repair")
alias fix := repair
# clean the nix store and optimise it
[group('dev')]
clean:
nh clean all -K 3d
nix store optimise
[group('dev')]
[private]
oldclean:
nix-collect-garbage --delete-older-than 3d
nix store optimise
# check the flake for errors
[group('dev')]
check:
nix flake check
# update the lock file, if inputs are provided, only update those, otherwise update all
[group('dev')]
update *input:
nix flake update {{ input }} --refresh
# build & serve the docs locally
[group('dev')]
serve:
nix run {{ flake }}#docs.serve