summaryrefslogtreecommitdiff
path: root/hosts
diff options
context:
space:
mode:
authorvin <vin@vineetk.net>2025-10-03 21:55:19 -0400
committervin <vin@vineetk.net>2025-10-03 21:59:16 -0400
commitb978d3406df70995fbbbedad5101450f5a5c4fdb (patch)
treec57fd954455ce771e714c3aaaa71bb58c957df12 /hosts
parentd52dba106ba98dc9bd8e04d289050122e3e3b690 (diff)
modularize more
Diffstat (limited to 'hosts')
-rw-r--r--hosts/demiurge/default.nix335
1 files changed, 22 insertions, 313 deletions
diff --git a/hosts/demiurge/default.nix b/hosts/demiurge/default.nix
index 749191a..75885e3 100644
--- a/hosts/demiurge/default.nix
+++ b/hosts/demiurge/default.nix
@@ -11,6 +11,8 @@
11{ 11{
12 imports = [ 12 imports = [
13 ./hardware.nix 13 ./hardware.nix
14 ../../modules/common.nix
15 ../../modules/desktop.nix
14 home-manager.nixosModules.default 16 home-manager.nixosModules.default
15 ]; 17 ];
16 18
@@ -63,39 +65,16 @@
63 }; 65 };
64 66
65 # boot options 67 # boot options
66 boot = { 68 boot.zfs.extraPools = [
67 kernel.sysctl = { 69 "data_nvme"
68 "net.ipv4.ip_forward" = true; 70 "data_wd"
69 "net.ipv6.conf.all.forwarding" = true; 71 ];
70 };
71
72 kernelPackages = pkgs.linuxPackages_6_12;
73
74 loader = {
75 systemd-boot.enable = true;
76 efi.canTouchEfiVariables = true;
77 };
78
79 supportedFilesystems = [ "zfs" ];
80
81 zfs = {
82 devNodes = "/dev/disk/by-partuuid";
83 extraPools = [
84 "data_nvme"
85 "data_wd"
86 ];
87 forceImportRoot = false;
88 };
89 };
90 72
91 # disable wifi and open some ports 73 # disable wifi and open some ports
92 networking = { 74 networking = {
93 hostName = "demiurge"; 75 hostName = "demiurge";
94 hostId = "cafebabe"; 76 hostId = "cafebabe";
95 77
96 # I like my ethX/wlanX names
97 usePredictableInterfaceNames = false;
98
99 wireless.enable = false; 78 wireless.enable = false;
100 79
101 firewall = { 80 firewall = {
@@ -151,216 +130,29 @@
151 }; 130 };
152 }; 131 };
153 132
154 # Set your time zone.
155 time.timeZone = "America/Toronto";
156
157 # Select internationalisation properties.
158 i18n.defaultLocale = "en_US.UTF-8";
159 console = {
160 font = "Lat2-Terminus16";
161 };
162
163 # enable flakes and nix cli
164 nix.settings.experimental-features = [
165 "nix-command"
166 "flakes"
167 ];
168
169 # Define a user account.
170 users.users = { 133 users.users = {
171 vin = { 134 vin.packages = with pkgs; [
172 isNormalUser = true; 135 alvr
173 136 bs-manager
174 extraGroups = [ 137 (llama-cpp.packages.x86_64-linux.rocm.override {
175 "transmission" 138 useMetalKit = false;
176 "wheel" 139 useVulkan = true;
177 ]; 140 })
178 141 #(vllm.override { cudaSupport = false; rocmSupport = true; gpuTargets = [ "gfx906" "gfx1100" ]; })
179 shell = pkgs.zsh; 142 ];
180
181 openssh.authorizedKeys.keys = [
182 "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEvM0xCLziR+ZT/SYE1aZM6dklbw4fEC17TWqbADIZRH vin@demiurge"
183 ];
184
185 packages = with pkgs; [
186 alvr
187 bs-manager
188 (llama-cpp.packages.x86_64-linux.rocm.override {
189 useMetalKit = false;
190 useVulkan = true;
191 })
192 #(vllm.override { cudaSupport = false; rocmSupport = true; gpuTargets = [ "gfx906" "gfx1100" ]; })
193 ];
194 };
195 143
196 radarr.extraGroups = [ "transmission" ]; 144 radarr.extraGroups = [ "transmission" ];
197 sonarr.extraGroups = [ "transmission" ]; 145 sonarr.extraGroups = [ "transmission" ];
198 }; 146 };
199 147
200 # default packages for both me and root
201 environment = {
202 systemPackages = with pkgs; [
203 doas-sudo-shim
204 git
205 wget
206 ];
207
208 pathsToLink = [ "/share/zsh" ];
209 };
210
211 # enable bluetooth and add some udev rules
212 hardware = {
213 bluetooth.enable = true;
214 flipperzero.enable = true;
215 keyboard.qmk.enable = true;
216 };
217
218 programs = {
219 # for gtk in home-manager
220 dconf.enable = true;
221
222 # gpg
223 gnupg.agent = {
224 enable = true;
225 enableSSHSupport = false;
226 pinentryPackage = pkgs.pinentry-rofi;
227 settings.default-cache-ttl = 600;
228 };
229
230 # disable nano. I don't like nano.
231 nano.enable = false;
232
233 # steam, proprietary. I sometimes like playing nonfree games too.
234 steam.enable = true;
235
236 # configuration in home-manager
237 zsh.enable = true;
238 zsh.promptInit = "PS1='$ '";
239 };
240
241 security = {
242 # I prefer doas over sudo for simplicity
243 doas = {
244 enable = true;
245 extraRules = [
246 {
247 users = [ "vin" ];
248 keepEnv = true;
249 persist = true;
250 }
251 ];
252 };
253 sudo.enable = false;
254
255 # needed to give realtime privileges to pipewire
256 rtkit.enable = true;
257
258 # trust certificate for *.demiurge.epistemia
259 pki.certificates = [
260 ''
261 -----BEGIN CERTIFICATE-----
262 MIIELzCCApegAwIBAgIRANnOZgETCYAX7+HrLIGpk5AwDQYJKoZIhvcNAQELBQAw
263 ezEeMBwGA1UEChMVbWtjZXJ0IGRldmVsb3BtZW50IENBMSgwJgYDVQQLDB92aW5A
264 ZGVtaXVyZ2UuZXBpc3RlbWlhIChWaW5lZXQpMS8wLQYDVQQDDCZta2NlcnQgdmlu
265 QGRlbWl1cmdlLmVwaXN0ZW1pYSAoVmluZWV0KTAeFw0yNTA5MjEyMzE4MDFaFw0y
266 NzEyMjIwMDE4MDFaMEAxJzAlBgNVBAoTHm1rY2VydCBkZXZlbG9wbWVudCBjZXJ0
267 aWZpY2F0ZTEVMBMGA1UECwwMdmluQGRlbWl1cmdlMIIBIjANBgkqhkiG9w0BAQEF
268 AAOCAQ8AMIIBCgKCAQEA7RhsOzlGqpgKVV02WFoT0bIeqUNQ5d6MFl+w9TsKSy7G
269 yhWMOjUMchm5oco33QMwmzUpejqFuRtGIm9Gj1IoPKgK4hb+UVzJb1ZwevhWyQzr
270 al7rg2beb9dBYNXlZhpYjzLrom6FS/QrEEudjsrVwR5DdvYb+NeirXqWfL0NCiF8
271 GtDDAQdbdmLWJBrjfEO0YbLplgEvwJphxEdDuJsjqLOEGj+Q1ZONjQMTVxZOgIRl
272 u5DYItMESV/Rc0elBlapOeBatp01rvcdm2hGz3TaFusR4SeIcYOMoX+P4wK6sQZM
273 X9fR95cHv/Vx02S90I9LMpleti8tXwBNLgoho2fsmwIDAQABo2kwZzAOBgNVHQ8B
274 Af8EBAMCBaAwEwYDVR0lBAwwCgYIKwYBBQUHAwEwHwYDVR0jBBgwFoAUwZNUYxIJ
275 idGGuM7Kz8ysS+8Zc4cwHwYDVR0RBBgwFoIUKi5kZW1pdXJnZS5lcGlzdGVtaWEw
276 DQYJKoZIhvcNAQELBQADggGBAFdUThVUJpatQtnAxB6kV2mh0vdKzwhf4Mk+Su4d
277 /jAwNcM3m2xjSbjU+U5QyTI99qe+zvQF5WhVik+hWqcRPBF8NkeF47pZuAmiB+Vr
278 jL8iWyD8x7BER0PpCAGTCusNXXg3+Ttb2gygOOk+JJqvXpMXbbhCTgc1qJD3EziL
279 1hXZovZFTmdcPFV6iu+oyyMmzLQl0SIIgqIICs1F21HMNdwAWKX25NMK3YCJVuTf
280 ZxUfmLaqwnr5liS7aa7xZRzaee58VouUL9RtLT+JxLsg9EYV31dHJ57fNTBqzGsw
281 2X03iE9+p87UHwd/7SnO5K+y7FpUu96LsAyeNnRuO2ys+3XwCVS7xjA7MwyAnfJt
282 i8WMWzlQbxhppK/QO/R8/rt0RcNHY9fp8ZK7qVZWF/rnTVUbw1ZmFLBDbuY9ehq9
283 vgQF6lZFCIKkf7am2vqwZHVtx1R+Cgl9/+4YlLPOeMmRyI3SFaIERRiHT0SuvqzF
284 SivxomFBHWe4CLwWy/mDaC18/g==
285 -----END CERTIFICATE-----
286 ''
287 ];
288 };
289
290 services = { 148 services = {
291 # dns
292 unbound = {
293 enable = true;
294 settings = {
295 server = {
296 interface = [
297 "127.0.0.1"
298 "100.64.0.2"
299 #"fd00:b0ba:cafe:babe::2"
300 "::1"
301 ];
302 access-control = [
303 "0.0.0.0/0 allow"
304 "::0/0 allow"
305 ];
306
307 hide-identity = true;
308 hide-version = true;
309
310 # Synthesize NXDOMAINs from DNSSEC NSEC chains.
311 # https://tools.ietf.org/html/rfc8198
312 aggressive-nsec = false;
313
314 module-config = "\"respip validator iterator\"";
315
316 local-data = [
317 "\"saklas.epistemia. 86400 IN A 100.64.0.1\""
318 "\"demiurge.epistemia. 86400 IN A 100.64.0.2\""
319 "\"hastur.epistemia. 86400 IN A 100.64.0.3\""
320 "\"iphonebob.epistemia. 86400 IN A 100.64.0.4\""
321 "\"lab.epistemia. 86400 IN A 100.64.0.5\""
322 ];
323
324 local-zone = [
325 "\"saklas.epistemia.\" redirect"
326 "\"demiurge.epistemia.\" redirect"
327 "\"hastur.epistemia.\" redirect"
328 "\"iphonebob.epistemia.\" redirect"
329 "\"lab.epistemia.\" redirect"
330 ];
331 };
332
333 # hagezi for dns-based adblocking (in addition to others)
334 rpz = {
335 name = "hagezi.ultimate";
336 zonefile = "hagezi.ultimate";
337 url = "https://raw.githubusercontent.com/hagezi/dns-blocklists/main/rpz/ultimate.txt";
338 };
339
340 # go through mullvad for regular dns queries
341 forward-zone = {
342 name = ".";
343 forward-addr = [ "194.242.2.2" ];
344 };
345 };
346 };
347
348 # vpn 149 # vpn
150 # TODO replace with wireguard again
349 tailscale = { 151 tailscale = {
350 enable = true;
351 authKeyFile = config.age.secrets.tailscale_demiurge.path; 152 authKeyFile = config.age.secrets.tailscale_demiurge.path;
352 disableTaildrop = true;
353 disableUpstreamLogging = true;
354 extraSetFlags = [ "--advertise-exit-node" ]; 153 extraSetFlags = [ "--advertise-exit-node" ];
355 #extraUpFlags = [ "--login-server=https://headscale.13f0.net" ];
356 extraUpFlags = [ "--login-server=https://controlplane.tailscale.com" ];
357 openFirewall = true;
358 useRoutingFeatures = "both";
359 }; 154 };
360 155
361 # automatically scrub zfs pools (every week by default)
362 zfs.autoScrub.enable = true;
363
364 # media server 156 # media server
365 jellyfin = { 157 jellyfin = {
366 enable = true; 158 enable = true;
@@ -402,19 +194,6 @@
402 }; 194 };
403 }; 195 };
404 196
405 # graphical input
406 libinput = {
407 enable = true;
408
409 mouse.accelProfile = "flat";
410
411 touchpad = {
412 accelProfile = "flat";
413 tapping = true;
414 tappingButtonMap = "lrm";
415 };
416 };
417
418 # music streaming to phone 197 # music streaming to phone
419 navidrome = { 198 navidrome = {
420 enable = true; 199 enable = true;
@@ -484,22 +263,11 @@
484 }; 263 };
485 264
486 # ssh 265 # ssh
487 openssh = { 266 openssh.listenAddresses = [
488 enable = true; 267 { addr = "127.0.0.1"; port = 22; }
489 268 { addr = "192.168.1.2"; port = 22; }
490 listenAddresses = [ 269 { addr = "100.64.0.2"; port = 22; }
491 { addr = "127.0.0.1"; port = 22; } 270 ];
492 { addr = "192.168.1.2"; port = 22; }
493 { addr = "100.64.0.2"; port = 22; }
494 ];
495
496 settings = {
497 KbdInteractiveAuthentication = false;
498 PasswordAuthentication = true;
499 PermitRootLogin = "no";
500 X11Forwarding = true;
501 };
502 };
503 271
504 # llm 272 # llm
505 open-webui = { 273 open-webui = {
@@ -511,44 +279,6 @@
511 port = 8083; 279 port = 8083;
512 }; 280 };
513 281
514 # for yubikey
515 pcscd.enable = true;
516
517 # sound. for some reason, pipewire enabled itself when I tried
518 # using pulseaudio and home-manager, so had to disable pulseaudio.
519 pipewire = {
520 enable = true;
521 alsa.enable = true;
522 audio.enable = true;
523 pulse.enable = true;
524 wireplumber = {
525 enable = true;
526 extraConfig = {
527 "51-set-default-eq.conf" = {
528 text = ''
529 monitor.rules = [
530 {
531 matches = [
532 {
533 # This rule matches the node with the name of your sink (node 35)
534 "node.name" = "effect_input.eq6"
535 }
536 ]
537 actions = {
538 update-props = {
539 # This sets a very high priority, making it the default.
540 # Standard hardware is usually around 1000.
541 "priority.session" = 2001
542 }
543 }
544 }
545 ]
546 '';
547 };
548 };
549 };
550 };
551
552 # reddit 282 # reddit
553 redlib = { 283 redlib = {
554 enable = true; 284 enable = true;
@@ -1023,31 +753,10 @@
1023 GROUP="input", SYMLINK+="ocuquest%n" 753 GROUP="input", SYMLINK+="ocuquest%n"
1024 ''; 754 '';
1025 }; 755 };
1026
1027 # to get startx and use amdgpu driver
1028 # WM in home-manager
1029 xserver = {
1030 enable = true;
1031 autorun = false;
1032 displayManager.startx.enable = true;
1033 modules = [ pkgs.xf86_input_wacom ];
1034 videoDrivers = [ "amdgpu" ];
1035 wacom.enable = true;
1036 };
1037 }; 756 };
1038 757
1039 # extra systemd stuff 758 # extra systemd stuff
1040 systemd.services = { 759 systemd.services.nginx.after = [ "tailscaled-autoconnect.service" ];
1041 nginx.after = [ "tailscaled-autoconnect.service" ];
1042 };
1043
1044 # create caches and use mandoc
1045 documentation.man = {
1046 enable = true;
1047 generateCaches = true;
1048 man-db.enable = false;
1049 mandoc.enable = true;
1050 };
1051 760
1052 system.stateVersion = "24.05"; 761 system.stateVersion = "24.05";
1053} 762}