summaryrefslogtreecommitdiff
path: root/hosts/vidhar/zfs.nix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2023-12-03 11:27:28 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2023-12-03 11:27:28 +0100
commit5dbccbbd1dc26681b6478842dd01be8b3e93c603 (patch)
treeefc22a777c88d04f84ed70165f878e57739dc09e /hosts/vidhar/zfs.nix
parentbde3c17e178e9c56422ab7da1c61d2718dfc5567 (diff)
downloadnixos-5dbccbbd1dc26681b6478842dd01be8b3e93c603.tar
nixos-5dbccbbd1dc26681b6478842dd01be8b3e93c603.tar.gz
nixos-5dbccbbd1dc26681b6478842dd01be8b3e93c603.tar.bz2
nixos-5dbccbbd1dc26681b6478842dd01be8b3e93c603.tar.xz
nixos-5dbccbbd1dc26681b6478842dd01be8b3e93c603.zip
...
Diffstat (limited to 'hosts/vidhar/zfs.nix')
-rw-r--r--hosts/vidhar/zfs.nix63
1 files changed, 39 insertions, 24 deletions
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 @@
1{ pkgs, lib, config, ... }: 1{ pkgs, lib, config, ... }:
2
3with lib;
4
2{ 5{
3 config = { 6 config = {
4 fileSystems = { 7 fileSystems = {
@@ -12,9 +15,10 @@
12 fsType = "zfs"; 15 fsType = "zfs";
13 }; 16 };
14 17
15 "/root" = 18 "/var/lib/sops-nix" =
16 { device = "ssd-raid1/safe/home-root"; 19 { device = "ssd-raid1/local/var-lib-sops--nix";
17 fsType = "zfs"; 20 fsType = "zfs";
21 neededForBoot = true;
18 }; 22 };
19 23
20 "/var/lib/systemd" = 24 "/var/lib/systemd" =
@@ -29,31 +33,36 @@
29 neededForBoot = true; 33 neededForBoot = true;
30 }; 34 };
31 35
32 "/var/lib/sops-nix" = 36 "/etc/zfs/zfs-list.cache" =
33 { device = "ssd-raid1/local/var-lib-sops--nix"; 37 { device = "ssd-raid1/local/zfs-zfs--list.cache";
34 fsType = "zfs"; 38 fsType = "zfs";
35 neededForBoot = true; 39 neededForBoot = true;
36 }; 40 };
37 41
38 "/var/lib/unbound" = 42 "/root" =
39 { device = "ssd-raid1/local/var-lib-unbound"; 43 { device = "ssd-raid1/safe/home-root";
40 fsType = "zfs"; 44 fsType = "zfs";
41 }; 45 };
42 46
47 # "/var/lib/unbound" =
48 # { device = "ssd-raid1/local/var-lib-unbound";
49 # fsType = "zfs";
50 # };
51
43 # "/var/lib/dhcp" = 52 # "/var/lib/dhcp" =
44 # { device = "ssd-raid1/local/var-lib-dhcp"; 53 # { device = "ssd-raid1/local/var-lib-dhcp";
45 # fsType = "zfs"; 54 # fsType = "zfs";
46 # }; 55 # };
47 56
48 "/var/lib/chrony" = 57 # "/var/lib/chrony" =
49 { device = "ssd-raid1/local/var-lib-chrony"; 58 # { device = "ssd-raid1/local/var-lib-chrony";
50 fsType = "zfs"; 59 # fsType = "zfs";
51 }; 60 # };
52 61
53 "/var/lib/samba" = 62 # "/var/lib/samba" =
54 { device = "ssd-raid1/local/var-lib-samba"; 63 # { device = "ssd-raid1/local/var-lib-samba";
55 fsType = "zfs"; 64 # fsType = "zfs";
56 }; 65 # };
57 66
58 # "/var/lib/prometheus2" = 67 # "/var/lib/prometheus2" =
59 # { device = "ssd-raid1/local/var-lib-prometheus2"; 68 # { device = "ssd-raid1/local/var-lib-prometheus2";
@@ -124,13 +133,21 @@
124 users.users.gkleen.createHome = lib.mkForce false; 133 users.users.gkleen.createHome = lib.mkForce false;
125 users.users.mherold.createHome = lib.mkForce false; 134 users.users.mherold.createHome = lib.mkForce false;
126 135
127 boot.postBootCommands = '' 136 systemd.generators."zfs-mount-generator" = "${config.boot.zfs.package}/lib/systemd/system-generator/zfs-mount-generator";
128 echo "=== STARTING ZPOOL IMPORT ===" 137 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";
129 ${pkgs.zfs}/bin/zpool import -a -N -d /dev 138 systemd.services.zfs-mount.enable = false;
130 ${pkgs.zfs}/bin/zpool status 139
131 ${pkgs.zfs}/bin/zfs mount -a 140 services.zfs.zed.settings.PATH = mkForce (makeBinPath (with pkgs; [
132 echo "=== ZPOOL IMPORT COMPLETE ===" 141 diffutils
133 ''; 142 config.boot.zfs.package
143 coreutils
144 curl
145 gawk
146 gnugrep
147 gnused
148 nettools
149 util-linux
150 ]));
134 151
135 services.zfssnap = { 152 services.zfssnap = {
136 enable = true; 153 enable = true;
@@ -152,8 +169,6 @@
152 enable = true; 169 enable = true;
153 interval = "Sun *-*-1..7 04:00:00"; 170 interval = "Sun *-*-1..7 04:00:00";
154 }; 171 };
155 services.zfs.zed.settings = { 172 services.zfs.zed.settings.ZED_SYSLOG_SUBCLASS_EXCLUDE = "history_event";
156 ZED_SYSLOG_SUBCLASS_EXCLUDE = "history_event";
157 };
158 }; 173 };
159} 174}