From 5dbccbbd1dc26681b6478842dd01be8b3e93c603 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 3 Dec 2023 11:27:28 +0100 Subject: ... --- hosts/vidhar/zfs.nix | 63 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 24 deletions(-) (limited to 'hosts/vidhar/zfs.nix') 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"; }; } -- cgit v1.2.3