From 5dbccbbd1dc26681b6478842dd01be8b3e93c603 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 3 Dec 2023 11:27:28 +0100 Subject: ... --- hosts/vidhar/default.nix | 31 +++++++++++++++-- hosts/vidhar/zfs.nix | 63 +++++++++++++++++++++------------- overlays/worktime/worktime/__main__.py | 7 ++++ 3 files changed, 74 insertions(+), 27 deletions(-) diff --git a/hosts/vidhar/default.nix b/hosts/vidhar/default.nix index 6b266e2b..59518f07 100644 --- a/hosts/vidhar/default.nix +++ b/hosts/vidhar/default.nix @@ -35,6 +35,33 @@ with lib; tmp.useTmpfs = true; initrd = { + systemd = { + enable = true; + network = { + enable = true; + networks = { + "eno1" = { + matchConfig.Name = "eno1"; + networkConfig = { + LLMNR = false; + MulticastDNS = false; + DNSSEC = false; + LinkLocalAddressing = "no"; + Address = [ + "10.141.1.1/24" + ]; + DHCPServer = true; + }; + dhcpServerConfig = { + EmitDNS = false; + EmitRouter = false; + EmitTimezone = false; + }; + }; + }; + }; + }; + supportedFilesystems = [ "zfs" ]; availableKernelModules = [ "ehci_pci" "ahci" "nvme" "isci" "xhci_pci" "usb_storage" "usbhid" "sd_mod" "sr_mod" "drbg" "rtsx_pci_sdmmc" "libsas" "scsi_transport_sas" "e1000e" ]; kernelModules = [ "dm-raid" "dm-integrity" "dm-snapshot" "dm-thin-pool" ]; @@ -50,8 +77,6 @@ with lib; hdd4.device = "/dev/disk/by-label/${hostName}-hdd4"; hdd5.device = "/dev/disk/by-label/${hostName}-hdd5"; }; - - network.flushBeforeStage2 = false; }; }; @@ -308,7 +333,7 @@ with lib; BATTERYLEVEL 10 MINUTES 5 POLLTIME 1 - ONBATTERYDELAY 0 + ONBATTERYDELAY 20 NOLOGON disable ''; }; diff --git a/hosts/vidhar/zfs.nix b/hosts/vidhar/zfs.nix index b490a6c2..518c3287 100644 --- a/hosts/vidhar/zfs.nix +++ b/hosts/vidhar/zfs.nix @@ -1,4 +1,7 @@ { pkgs, lib, config, ... }: + +with lib; + { config = { fileSystems = { @@ -12,9 +15,10 @@ fsType = "zfs"; }; - "/root" = - { device = "ssd-raid1/safe/home-root"; + "/var/lib/sops-nix" = + { device = "ssd-raid1/local/var-lib-sops--nix"; fsType = "zfs"; + neededForBoot = true; }; "/var/lib/systemd" = @@ -29,31 +33,36 @@ neededForBoot = true; }; - "/var/lib/sops-nix" = - { device = "ssd-raid1/local/var-lib-sops--nix"; + "/etc/zfs/zfs-list.cache" = + { device = "ssd-raid1/local/zfs-zfs--list.cache"; fsType = "zfs"; neededForBoot = true; }; - "/var/lib/unbound" = - { device = "ssd-raid1/local/var-lib-unbound"; + "/root" = + { device = "ssd-raid1/safe/home-root"; fsType = "zfs"; }; + # "/var/lib/unbound" = + # { device = "ssd-raid1/local/var-lib-unbound"; + # fsType = "zfs"; + # }; + # "/var/lib/dhcp" = # { device = "ssd-raid1/local/var-lib-dhcp"; # fsType = "zfs"; # }; - "/var/lib/chrony" = - { device = "ssd-raid1/local/var-lib-chrony"; - fsType = "zfs"; - }; + # "/var/lib/chrony" = + # { device = "ssd-raid1/local/var-lib-chrony"; + # fsType = "zfs"; + # }; - "/var/lib/samba" = - { device = "ssd-raid1/local/var-lib-samba"; - fsType = "zfs"; - }; + # "/var/lib/samba" = + # { device = "ssd-raid1/local/var-lib-samba"; + # fsType = "zfs"; + # }; # "/var/lib/prometheus2" = # { device = "ssd-raid1/local/var-lib-prometheus2"; @@ -124,13 +133,21 @@ users.users.gkleen.createHome = lib.mkForce false; users.users.mherold.createHome = lib.mkForce false; - boot.postBootCommands = '' - echo "=== STARTING ZPOOL IMPORT ===" - ${pkgs.zfs}/bin/zpool import -a -N -d /dev - ${pkgs.zfs}/bin/zpool status - ${pkgs.zfs}/bin/zfs mount -a - echo "=== ZPOOL IMPORT COMPLETE ===" - ''; + systemd.generators."zfs-mount-generator" = "${config.boot.zfs.package}/lib/systemd/system-generator/zfs-mount-generator"; + environment.etc."zfs/zed.d/history_event-zfs-list-cacher.sh".source = "${config.boot.zfs.package}/etc/zfs/zed.d/history_event-zfs-list-cacher.sh"; + systemd.services.zfs-mount.enable = false; + + services.zfs.zed.settings.PATH = mkForce (makeBinPath (with pkgs; [ + diffutils + config.boot.zfs.package + coreutils + curl + gawk + gnugrep + gnused + nettools + util-linux + ])); services.zfssnap = { enable = true; @@ -152,8 +169,6 @@ enable = true; interval = "Sun *-*-1..7 04:00:00"; }; - services.zfs.zed.settings = { - ZED_SYSLOG_SUBCLASS_EXCLUDE = "history_event"; - }; + services.zfs.zed.settings.ZED_SYSLOG_SUBCLASS_EXCLUDE = "history_event"; }; } diff --git a/overlays/worktime/worktime/__main__.py b/overlays/worktime/worktime/__main__.py index 35aef8f7..14381e0c 100755 --- a/overlays/worktime/worktime/__main__.py +++ b/overlays/worktime/worktime/__main__.py @@ -244,6 +244,13 @@ class Worktime(object): holidays[datetime(year, 12, 25, tzinfo=tzlocal()).date()] = 1 holidays[datetime(year, 12, 26, tzinfo=tzlocal()).date()] = 1 + # TV-L + holidays[datetime(year, 12, 24, tzinfo=tzlocal()).date()] = 1 + holidays[datetime(year, 12, 31, tzinfo=tzlocal()).date()] = 1 + + # LMU + holidays[(y_easter+timedelta(days=-47)).date()] = 0.5 + return holidays @staticmethod -- cgit v1.2.3