-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.nix
371 lines (327 loc) · 8.33 KB
/
setup.nix
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
{
lib,
config,
...
}: let
inherit (lib) mkOption types;
defaultTrue = mkOption {
default = true;
type = types.bool;
};
defaultFalse = mkOption {
default = false;
type = types.bool;
};
in {
imports = [
./modules/core.nix
./modules/home-manager.nix
./modules/graphical
./modules/laptop
./modules/androidTools
./modules/desktopEnvironments
./modules/displayManagers
./modules/development
./modules/gaming
./modules/openRGB
./modules/impermanence
./modules/homeServer
./modules/pam
./modules/printing
./modules/secrets
./modules/uinput
./modules/users
./modules/virtualBox
];
options.setup = {
hostname = mkOption {
type = types.nonEmptyStr;
};
isGraphical = defaultTrue;
isLaptop = defaultFalse;
# === Basic system config
ssh = {
enable = defaultTrue;
mosh = defaultTrue;
};
# === Android dev
androidTools = {
enable = defaultFalse;
droidcam = defaultTrue;
users = mkOption {
type = types.listOf types.nonEmptyStr;
default = [];
};
};
# === Desktop stuff
profilePictures = mkOption {
type = types.submodule {
freeformType = types.attrsOf types.path;
};
default = {};
};
desktopEnvironments = {
cinnamon = {
enable = defaultFalse;
};
gnome = {
enable = defaultFalse;
minimal = defaultTrue;
};
};
displayManagers = {
gdm = {
enable = defaultFalse;
};
sddm = {
enable = defaultFalse;
theme = mkOption {
type = types.nullOr types.package;
};
};
};
# === Development
binfmt = {
aarch64 = defaultFalse;
};
# === Gaming
gaming = {
enable = defaultFalse;
emulators = {
ps3 = defaultTrue;
};
lutris = defaultTrue;
minecraft = defaultTrue;
steam = {
enable = defaultTrue;
enableProtonGE = defaultTrue;
};
};
openRGB = {
enable = defaultFalse;
usePlugins = defaultTrue;
};
# === Home server
homeServer = {
enable = defaultFalse;
domainName = mkOption {
type = types.nonEmptyStr;
};
dataRoot = mkOption {
type = types.nonEmptyStr;
};
# All the ports used by different services
ports = let
port = num:
mkOption {
type = types.port;
default = num;
};
in {
haproxy = {
myspeed = port 5217;
mediaServer = {
audiobookshelf = port 8001;
jellyseerr = port 5056;
};
};
homepage = port 42731;
adguardhome = {
http = port 3000;
https = port 3001;
dnsOverTls = port 853; # TCP
dnsOverQuic = port 853; # UDP
};
unbound = port 5335;
myspeed = port 5216;
ntfy = {
http = port 4000;
https = port 4001;
};
squid = port 3128;
mediaServer = {
audiobookshelf = port 8000;
calibre = {
server = port 8082;
web = port 8083;
};
jellyfin = {
http = port 8096;
https = port 8920;
};
jellyseerr = port 5055;
navidrome = port 4533;
bazarr = port 6767;
lidarr = port 8686;
radarr = port 7878;
readarr = port 8787;
speakarr = port 8282;
sonarr = port 8989;
prowlarr = port 9696;
transmission = port 9091;
};
personalProjects = {
winter-wonderlights = {
normal = port 23120;
scanner = port 23121;
};
};
};
adguardhome.enable = defaultFalse;
myspeed.enable = defaultFalse;
ntfy.enable = defaultFalse;
firefly-iii.enable = defaultFalse;
squid.enable = defaultFalse;
homeAutomation = {};
mediaServer = {
enable = defaultFalse;
mediaRoot = mkOption {
type = types.nonEmptyStr;
default = "${config.setup.homeServer.dataRoot}/media";
};
books = defaultTrue;
music = defaultTrue;
movies = defaultTrue;
telly = defaultTrue;
transmission = {
ovpnName = mkOption {
type = types.nonEmptyStr;
description = ''
The unqualified name of the OpenVPN config file to be used for transmission.
All files are expected to be /etc/openvpn/something.ovpn, so if this option was set to "gh_airvpn", then the relevant systemd service would expect to find /etc/openvpn/gb_airvpn.ovpn".
'';
};
thirdOctet = mkOption {
type = types.ints.between 1 255;
default = 5;
description = ''
We use a veth system to connect the normal internet to the network namespace used to keep transmission in a VPN. The veth interfaces have the IP addresses 192.168.X.1 and 192.168.X.2, where X is this thirdOctet option.
'';
};
};
};
personalProjects = {
enable = defaultFalse;
tictactoe = defaultTrue;
winter-wonderlights = defaultTrue;
wordle = defaultTrue;
};
};
# === Impermanence
impermanence = let
keepList = mkOption {
type = types.listOf (types.either types.nonEmptyStr types.submodule);
default = [];
};
in {
enable = defaultFalse;
debug = defaultFalse;
keepDirs = keepList;
keepFiles = keepList;
};
# === Passwords
pamShortenFailDelay = {
enable = defaultTrue;
microseconds = mkOption {
type = types.ints.unsigned;
default = 150000; # 150 ms
};
};
# === Printing
printing = {
enable = defaultFalse;
networkAutoDiscovery = defaultTrue;
scanning = defaultTrue;
users = mkOption {
type = types.listOf types.nonEmptyStr;
default = [];
};
specificPrinters = {
canonPixmaMG3250 = defaultFalse;
};
};
# === Secrets
secrets = {
enable = defaultTrue;
userPasswords = {
enable = defaultTrue;
# Note that enabling any of these DOES NOT enable the user. Use
# `setup.users` to enable users.
users = {
dyson = defaultTrue;
pi = defaultTrue;
rebecca = defaultTrue;
};
};
networking = {
enable = defaultFalse;
simpleWifiNetworkNames = mkOption {
type = types.listOf types.nonEmptyStr;
default = ["HOME"];
description = ''The names of the simple WiFi networks to use. Each name here should have entries of the form "<name>_SSID" and "<name>_PSK" in the secret networking.env file.'';
};
complex = {
eduroam = defaultTrue;
};
};
vpn = {
enable = defaultFalse;
vpns = mkOption {
type = types.listOf (types.submodule {
options = {
vpnName = mkOption {
type = types.nonEmptyStr;
};
users = mkOption {
type = types.listOf types.nonEmptyStr;
};
};
});
default = [
{
vpnName = "ch_airvpn";
users = ["dyson"];
}
{
vpnName = "gb_airvpn";
users = ["dyson"];
}
{
vpnName = "us_airvpn";
users = ["dyson"];
}
];
};
};
tailscale.enable = defaultTrue;
cachix.enable = defaultTrue;
};
# === uinput
# We need uinput for xremap and weylus
uinput = {
enable = defaultFalse;
users = mkOption {
type = types.listOf types.nonEmptyStr;
default = [];
};
};
# === Users
users = {
dyson = defaultTrue;
pi = defaultFalse;
rebecca = defaultFalse;
};
# === VirtualBox
virtualBox = {
guest.enable = defaultFalse;
host = {
enable = defaultFalse;
users = mkOption {
type = types.listOf types.nonEmptyStr;
default = [];
};
asSpecialisation = defaultFalse;
};
};
};
}