blob: 3bfd2de40bde127dd73b4c97782c6df5bca3cebb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
{ config, lib, ... }:
let
cfg = config.os.srv.zfs;
in
{
options.os.srv.zfs.enable = lib.mkEnableOption "enables zfs drive maintnance";
config = lib.mkIf cfg.enable {
assertions = [
{
assertion = config.os.core.drivers.kernel == "zfs";
message = "ZFS requires the zfs supported kernel";
}
{
assertion = config.os.srv.sops.enable;
message = "required for storing the ntfy token";
}
];
sops.secrets."ntfy/zed".neededForUsers = false;
boot = {
kernelParams = [ "zfs.zfs_arc_max=${toString (32 * 1024 * 1024 * 1024)}" ];
zfs = {
requestEncryptionCredentials = [ "zroot" ];
useKeyringForCredentials = true;
extraPools = [ "tank" ];
};
supportedFilesystems = [ "zfs" ];
initrd.supportedFilesystems = [ "zfs" ];
};
services.zfs = {
expandOnBoot = "all";
autoScrub.enable = true;
trim.enable = true;
autoSnapshot = {
enable = true;
flags = "-k -p --utc";
};
zed = {
enableCustomScripts = true;
settings = {
ZED_DEBUG_LOG = "/var/log/zed.debug.log";
ZED_NOTIFY_INTERVAL_SECS = 3600;
ZED_NOTIFY_VERBOSE = 0;
ZED_USE_ENCLOSURE_LEDS = 1;
ZED_SCRUB_AFTER_RESILVER = 1;
ZED_POWER_OFF_ENCLOSURE_SLOT_ON_FAULT = 1;
ZED_POWER_OFF_ENCLOSURE_SLOT_ON_DEADMAN = 1;
ZED_NTFY_TOPIC = "zed-alerts-bibus-lab";
ZED_NTFY_URL = "http://${config.os.core.network.ips.monitor-vm}:8085";
};
};
};
systemd.services.zfs-zed.serviceConfig.EnvironmentFile = config.sops.secrets."ntfy/zed".path;
networking.hostId = "4e3e22e1";
};
}
|