btw i use nix
1{ pkgs, config, ... }:
2
3{
4 # to create:
5 # zpool create tank mirror /dev/disk/by-id/ata-ST16000NM001G-2KK103_ZL28CDKQ /dev/disk/by-id/ata-TOSHIBA_MG08ACA16TE_83E0A00UFVGG
6 # truncate -s 512G /var/zfs_cache
7 # zpool add poolname cache /var/zfs_cache
8
9 boot = {
10 supportedFilesystems = [ "zfs" ];
11 zfs.forceImportRoot = false;
12 zfs.extraPools = [ "tank" ];
13 kernelParams = [ "zfs.zfs_arc_max=12884901888" ];
14 };
15
16 networking.hostId = "e768032f";
17
18 services.zfs.autoScrub = {
19 enable = true;
20 interval = "Tue, 02:00";
21 };
22
23 age.secrets.email-elephant.file = ../../secrets/email-system.age;
24 programs.msmtp = {
25 enable = true;
26 setSendmail = true;
27 defaults = {
28 aliases = "/etc/aliases";
29 port = 465;
30 tls_trust_file = "/etc/ssl/certs/ca-certificates.crt";
31 tls = "on";
32 auth = "login";
33 tls_starttls = "off";
34 };
35 accounts = {
36 default = {
37 host = "mail.${config.networking.domain}";
38 passwordeval = "cat ${config.age.secrets.email-elephant.path}";
39 user = "system@${config.networking.domain}";
40 from = "nas@${config.networking.domain}";
41 };
42 };
43 };
44
45 services.zfs.zed.settings = {
46 ZED_DEBUG_LOG = "/tmp/zed.debug.log";
47 ZED_EMAIL_ADDR = [ "root" ];
48 ZED_EMAIL_PROG = "${pkgs.msmtp}/bin/msmtp";
49 ZED_EMAIL_OPTS = "@ADDRESS@";
50
51 ZED_NOTIFY_INTERVAL_SECS = 3600;
52 ZED_NOTIFY_VERBOSE = true;
53
54 ZED_USE_ENCLOSURE_LEDS = true;
55 ZED_SCRUB_AFTER_RESILVER = true;
56 };
57 # this option does not work; will return error
58 services.zfs.zed.enableMail = false;
59}