summaryrefslogtreecommitdiff
path: root/hosts/vidhar
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2022-10-31 15:15:00 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2022-10-31 15:15:00 +0100
commitf300ea69b66427bd2a5a92a4c4f0db0aa99392b0 (patch)
tree7cd983c26895bec9ad29f76990ece205a112f53e /hosts/vidhar
parent31832d598650eb17ba24a81680039b1973e80158 (diff)
downloadnixos-f300ea69b66427bd2a5a92a4c4f0db0aa99392b0.tar
nixos-f300ea69b66427bd2a5a92a4c4f0db0aa99392b0.tar.gz
nixos-f300ea69b66427bd2a5a92a4c4f0db0aa99392b0.tar.bz2
nixos-f300ea69b66427bd2a5a92a4c4f0db0aa99392b0.tar.xz
nixos-f300ea69b66427bd2a5a92a4c4f0db0aa99392b0.zip
...
Diffstat (limited to 'hosts/vidhar')
-rw-r--r--hosts/vidhar/default.nix46
-rw-r--r--hosts/vidhar/network/dhcp/default.nix28
-rw-r--r--hosts/vidhar/samba.nix25
-rw-r--r--hosts/vidhar/zfs.nix12
4 files changed, 80 insertions, 31 deletions
diff --git a/hosts/vidhar/default.nix b/hosts/vidhar/default.nix
index 3f5d17d5..fc77f03c 100644
--- a/hosts/vidhar/default.nix
+++ b/hosts/vidhar/default.nix
@@ -235,25 +235,30 @@ with lib;
235 ]; 235 ];
236 }; 236 };
237 }; 237 };
238 systemd.services.loki.preStart = let 238 systemd.services.loki = {
239 rulesYaml = generators.toYAML {} { 239 preStart = let
240 groups = [ 240 rulesYaml = generators.toYAML {} {
241 { name = "power-failures"; 241 groups = [
242 rules = [ 242 { name = "power-failures";
243 { record = "apcupsd_power_failures:per_day"; 243 rules = [
244 expr = "sum by (nodename) (rate({job=\"systemd-journal\"} | json | MESSAGE = \"Power failure.\"[1d])) * 86400"; 244 { record = "apcupsd_power_failures:per_day";
245 } 245 expr = "sum by (nodename) (rate({job=\"systemd-journal\"} | json | MESSAGE = \"Power failure.\"[1d])) * 86400";
246 { record = "apcupsd_power_failures:per_week"; 246 }
247 expr = "sum by (nodename) (rate({job=\"systemd-journal\"} | json | MESSAGE = \"Power failure.\"[1w])) * 604800"; 247 { record = "apcupsd_power_failures:per_week";
248 } 248 expr = "sum by (nodename) (rate({job=\"systemd-journal\"} | json | MESSAGE = \"Power failure.\"[1w])) * 604800";
249 ]; 249 }
250 } 250 ];
251 ]; 251 }
252 }; 252 ];
253 in '' 253 };
254 ${pkgs.coreutils}/bin/install -m 0755 -o ${config.services.loki.user} -g ${config.services.loki.group} -d ${config.services.loki.configuration.ruler.storage.local.directory}/fake 254 in ''
255 ${pkgs.coreutils}/bin/ln -sf ${pkgs.writeText "rules.yml" rulesYaml} ${config.services.loki.configuration.ruler.storage.local.directory}/fake/rules.yml 255 ${pkgs.coreutils}/bin/install -m 0755 -o ${config.services.loki.user} -g ${config.services.loki.group} -d ${config.services.loki.configuration.ruler.storage.local.directory}/fake
256 ''; 256 ${pkgs.coreutils}/bin/ln -sf ${pkgs.writeText "rules.yml" rulesYaml} ${config.services.loki.configuration.ruler.storage.local.directory}/fake/rules.yml
257 '';
258 serviceConfig.Environment = [
259 "ASSUME_NO_MOVING_GC_UNSAFE_RISK_IT_WITH=go1.19"
260 ];
261 };
257 services.promtail = { 262 services.promtail = {
258 enable = true; 263 enable = true;
259 configuration = { 264 configuration = {
@@ -286,6 +291,9 @@ with lib;
286 ]; 291 ];
287 }; 292 };
288 }; 293 };
294 systemd.services.promtail.serviceConfig.Environment = [
295 "ASSUME_NO_MOVING_GC_UNSAFE_RISK_IT_WITH=go1.19"
296 ];
289 297
290 services.apcupsd = { 298 services.apcupsd = {
291 enable = true; 299 enable = true;
diff --git a/hosts/vidhar/network/dhcp/default.nix b/hosts/vidhar/network/dhcp/default.nix
index dfaa4c9f..d3407f1d 100644
--- a/hosts/vidhar/network/dhcp/default.nix
+++ b/hosts/vidhar/network/dhcp/default.nix
@@ -23,6 +23,12 @@ with lib;
23 }; 23 };
24 24
25 client-classes = [ 25 client-classes = [
26 { name = "eos-ipxe";
27 test = "hexstring(pkt4.mac, ':') == '00:d8:61:79:c5:40' and option[77].hex == 'iPXE'";
28 next-server = "10.141.0.1";
29 boot-file-name = "http://nfsroot.vidhar.yggdrasil/eos/netboot.ipxe";
30 only-if-required = true;
31 }
26 { name = "ipxe"; 32 { name = "ipxe";
27 test = "option[77].hex == 'iPXE'"; 33 test = "option[77].hex == 'iPXE'";
28 next-server = "10.141.0.1"; 34 next-server = "10.141.0.1";
@@ -85,7 +91,7 @@ with lib;
85 ddns-send-updates = true; 91 ddns-send-updates = true;
86 ddns-qualifying-suffix = "lan.yggdrasil"; 92 ddns-qualifying-suffix = "lan.yggdrasil";
87 pools = [ { pool = "10.141.0.128 - 10.141.0.254"; } ]; 93 pools = [ { pool = "10.141.0.128 - 10.141.0.254"; } ];
88 require-client-classes = ["ipxe" "uefi-64" "uefi-32" "legacy"]; 94 require-client-classes = map (cc: cc.name) config.services.kea.dhcp4.settings.client-classes;
89 reservations = [ 95 reservations = [
90 { hostname = "sif"; 96 { hostname = "sif";
91 hw-address = "3c:e1:a1:52:24:35"; 97 hw-address = "3c:e1:a1:52:24:35";
@@ -258,7 +264,25 @@ with lib;
258 ${pkgs.closureInfo { rootPaths = installerBuild.storeContents; }}/registration 264 ${pkgs.closureInfo { rootPaths = installerBuild.storeContents; }}/registration
259 '') 265 '')
260 ) ["x86_64-linux"] 266 ) ["x86_64-linux"]
261 ); 267 ) ++ [
268 (let
269 eosBuild = (flake.nixosConfigurations.eos.extendModules {
270 modules = [
271 ({ ... }: {
272 config.nfsroot.storeDevice = "10.141.0.1:nix-store";
273 config.nfsroot.registrationUrl = "http://nfsroot.vidhar.yggdrasil/eos/registration";
274 })
275 ];
276 }).config.system.build;
277 in builtins.toPath (pkgs.runCommandLocal "eos" {} ''
278 mkdir -p $out/eos
279 install -m 0444 -t $out/eos \
280 ${eosBuild.initialRamdisk}/initrd \
281 ${eosBuild.kernel}/bzImage \
282 ${eosBuild.netbootIpxeScript}/netboot.ipxe \
283 ${pkgs.closureInfo { rootPaths = eosBuild.storeContents; }}/registration
284 ''))
285 ];
262 }; 286 };
263 }; 287 };
264 }; 288 };
diff --git a/hosts/vidhar/samba.nix b/hosts/vidhar/samba.nix
index 0ddf56a3..ffca9c6d 100644
--- a/hosts/vidhar/samba.nix
+++ b/hosts/vidhar/samba.nix
@@ -14,28 +14,45 @@
14 guest account = nobody 14 guest account = nobody
15 bind interfaces only = yes 15 bind interfaces only = yes
16 interfaces = lo lan 16 interfaces = lo lan
17 server signing = mandatory
18 server min protocol = SMB3
19 server smb encrypt = required
17 ''; 20 '';
18 shares = { 21 shares = {
19 homes = { 22 homes = {
20 comment = "Home Directories"; 23 comment = "Home directory for %S";
21 path = "/home/%S"; 24 path = "/home/%S";
22 browseable = "no"; 25 browseable = false;
23 "valid users" = "%S"; 26 "valid users" = "%S";
24 "read only" = "no"; 27 "read only" = false;
25 "create mask" = "0700"; 28 "create mask" = "0700";
26 "directory mask" = "0700"; 29 "directory mask" = "0700";
27 "vfs objects" = "shadow_copy2"; 30 "vfs objects" = "shadow_copy2";
28 "shadow:snapdir" = ".zfs/snapshot"; 31 "shadow:snapdir" = ".zfs/snapshot";
32 "shadow:snapdirseverywhere" = true;
29 "shadow:sort" = "desc"; 33 "shadow:sort" = "desc";
30 "shadow:format" = "%Y-%m-%dT%H:%M:%SZ"; 34 "shadow:format" = "%Y-%m-%dT%H:%M:%SZ";
31 }; 35 };
32 eos = { 36 eos = {
33 comment = "Disk image of eos"; 37 comment = "Disk image of legacy eos";
34 browseable = true; 38 browseable = true;
35 "valid users" = "mherold"; 39 "valid users" = "mherold";
36 writeable = "true"; 40 writeable = "true";
37 path = "/srv/eos"; 41 path = "/srv/eos";
38 }; 42 };
43 home-eos = {
44 comment = "Home directoriy for %u on PXE booted EOS";
45 path = "/srv/cifs/home-eos/%u";
46 volume = "%u@eos";
47 browseable = true;
48 "read only" = false;
49 "create mask" = "0700";
50 "directory mask" = "0700";
51 "vfs objects" = "shadow_copy2";
52 "shadow:snapdir" = ".zfs/snapshot";
53 "shadow:sort" = "desc";
54 "shadow:format" = "%Y-%m-%dT%H:%M:%SZ";
55 };
39 }; 56 };
40 }; 57 };
41 services.samba-wsdd = { 58 services.samba-wsdd = {
diff --git a/hosts/vidhar/zfs.nix b/hosts/vidhar/zfs.nix
index 52b48aca..1de4b9b7 100644
--- a/hosts/vidhar/zfs.nix
+++ b/hosts/vidhar/zfs.nix
@@ -23,7 +23,7 @@
23 fsType = "zfs"; 23 fsType = "zfs";
24 neededForBoot = true; 24 neededForBoot = true;
25 }; 25 };
26 26
27 "/var/lib/nixos" = 27 "/var/lib/nixos" =
28 { device = "ssd-raid1/local/var-lib-nixos"; 28 { device = "ssd-raid1/local/var-lib-nixos";
29 fsType = "zfs"; 29 fsType = "zfs";
@@ -34,22 +34,22 @@
34 { device = "ssd-raid1/local/var-lib-unbound"; 34 { device = "ssd-raid1/local/var-lib-unbound";
35 fsType = "zfs"; 35 fsType = "zfs";
36 }; 36 };
37 37
38 # "/var/lib/dhcp" = 38 # "/var/lib/dhcp" =
39 # { device = "ssd-raid1/local/var-lib-dhcp"; 39 # { device = "ssd-raid1/local/var-lib-dhcp";
40 # fsType = "zfs"; 40 # fsType = "zfs";
41 # }; 41 # };
42 42
43 "/var/lib/chrony" = 43 "/var/lib/chrony" =
44 { device = "ssd-raid1/local/var-lib-chrony"; 44 { device = "ssd-raid1/local/var-lib-chrony";
45 fsType = "zfs"; 45 fsType = "zfs";
46 }; 46 };
47 47
48 "/var/lib/samba" = 48 "/var/lib/samba" =
49 { device = "ssd-raid1/local/var-lib-samba"; 49 { device = "ssd-raid1/local/var-lib-samba";
50 fsType = "zfs"; 50 fsType = "zfs";
51 }; 51 };
52 52
53 # "/var/lib/prometheus2" = 53 # "/var/lib/prometheus2" =
54 # { device = "ssd-raid1/local/var-lib-prometheus2"; 54 # { device = "ssd-raid1/local/var-lib-prometheus2";
55 # fsType = "zfs"; 55 # fsType = "zfs";
@@ -67,7 +67,7 @@
67 # fsType = "zfs"; 67 # fsType = "zfs";
68 # options = [ "zfsutil" ]; 68 # options = [ "zfsutil" ];
69 # }; 69 # };
70 70
71 # "/srv/tftp" = 71 # "/srv/tftp" =
72 # { device = "ssd-raid1/local/srv-tftp"; 72 # { device = "ssd-raid1/local/srv-tftp";
73 # fsType = "zfs"; 73 # fsType = "zfs";