-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
151 lines (124 loc) · 4.13 KB
/
Copy pathTaskfile.yml
File metadata and controls
151 lines (124 loc) · 4.13 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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
version: "3"
vars:
IS_NIXOS:
sh: if [ -e /etc/NIXOS ]; then echo "true"; else echo "false"; fi
NIX_CMD:
sh: if [ -e /etc/NIXOS ]; then echo "sudo nixos-rebuild"; else echo "home-manager"; fi
NIX_BUILD_CMD:
sh: if [ -e /etc/NIXOS ]; then echo "nixos-rebuild"; else echo "home-manager"; fi
tasks:
echo:
requires:
vars:
- "IS_NIXOS"
- "NIX_CMD"
preconditions:
- '[ {{.IS_NIXOS}} -eq "true" ]'
cmds:
- echo {{.NIX_CMD}}
build:
desc: Build the flake.
requires:
vars:
- "NIX_BUILD_CMD"
cmds:
- "{{.NIX_BUILD_CMD}} build --flake .{{.CLI_ARGS}}" # --print-build-logs --verbose
build-do-image:
desc: Build the Digital Ocean custom image
cmd: nix build .#do-image
build-iso:
desc: Build an installer ISO [gnome|min]
cmd: nix build .#nixosConfigurations.iso-{{.CLI_ARGS}}.config.system.build.isoImage
build-hives:
desc: Build all hives without deploying
cmd: nix run .#colmena -- build --impure
build-hive:
desc: Build local hive without deploying
cmd: nix run .#colmena -- build --impure --on @{{.CLI_ARGS}}
build-all:
desc: Build everything.
cmds:
- nixos-rebuild build --flake .#ruca
- nixos-rebuild build --flake .#lappy
- nix run .#colmena -- build --impure
- nix build .#do-image
- nix build .#nixosConfigurations.iso-gnome.config.system.build.isoImage
- nix build .#nixosConfigurations.iso-min.config.system.build.isoImage
switch:
desc: Build then switch to the new build.
cmd: "{{.NIX_CMD}} switch --flake ."
boot:
desc: Build the flake and set for next boot.
requires:
vars:
- "NIX_CMD"
cmds:
- "{{.NIX_CMD}} boot --flake .{{.CLI_ARGS}}"
deploy:
desc: Deploy configuration to remote host
cmds:
- nixos-rebuild switch --flake .#{{.CLI_ARGS}} --target-host sysconf@{{.CLI_ARGS}} --sudo --ask-sudo-password
eval:
desc: Show a configuration value.
cmds:
- nix eval .#{{.CLI_ARGS}} # task eval -- nixosConfigurations.ruca.config.services.xserver.videoDrivers
option:
desc: Show the calculated value of a flake option.
cmds:
- nixos-option --flake . {{.CLI_ARGS}}
clean:
desc: Delete the result directory that the build task creates.
cmds:
- rm -rf result
update:
desc: Update packages and the lock file.
cmds:
- nix flake update {{.CLI_ARGS}}
gc:
desc: Run both gc tasks.
deps: [gc-os, gc-hm]
gc-hm:
desc: Delete old unused home manager packages.
cmds:
- nix-collect-garbage --delete-older-than 14d # home-manager stuff in user's home directory
gc-os:
desc: Delete old unused system packages.
requires:
vars:
- "IS_NIXOS"
preconditions:
- '[ {{.IS_NIXOS}} -eq "true" ]'
cmds:
- sudo nix-collect-garbage --delete-older-than 14d # system wide
news:
desc: Display Home Manager news
cmds:
- home-manager news --flake .
history:
desc: List all previous generations available.
cmd: nix profile history --profile /nix/var/nix/profiles/system
iso-burn:
desc: Burn an iso to a USB drive
cmd: caligula burn $(gum file ./result/iso)
iso-copy:
desc: Copy the iso to a USB drive
cmd: cp result/iso/*.iso /run/media/$USER/Ventoy
deploy-hive:
desc: Deploy a hive
cmd: nix run .#colmena -- apply --impure --on @{{.CLI_ARGS}}
deploy-hives:
desc: Deploy all hives
cmd: nix run .#colmena -- apply --impure
upload-keys:
desc: Upload deploy keys to a hive. Required after reboot.
cmds:
- nix run .#colmena -- upload-keys --impure --on @{{.CLI_ARGS}}
# Update password after key upload (hashedPasswordFile requires activation to update /etc/shadow)
- ssh sysconf@{{.CLI_ARGS}} "sudo /run/current-system/activate"
niri-validate:
desc: Validate the Niri configuration KDL files.
cmd: find nix/modules/home/desktop -name '*.kdl' -type f -print -exec niri validate -c {} \;
test-blocky:
desc: Test Blocky DNS server (default 192.168.0.22)
cmds:
- ./nix/modules/system/services/blocky/test.sh {{.CLI_ARGS | default "192.168.0.22"}}