{ service_configs, pkgs, ... }: let zfs-key = "/etc/zfs-key"; in { system.activationScripts = { "zfs-key".text = '' #!/bin/sh rm -fr ${zfs-key} || true cp ${./secrets/zfs-key} ${zfs-key} ''; }; boot.zfs.package = pkgs.zfs_unstable; boot.initrd.kernelModules = [ "zfs" ]; boot.kernelParams = [ # 2048MB "zfs.zfs_arc_max=2048000000" ]; boot.supportedFilesystems = [ "zfs" ]; boot.zfs.extraPools = [ service_configs.zpool ]; services.zfs = { autoScrub.enable = true; trim.enable = true; # doesn't work, maybe replace with `services.sanoid` instead autoSnapshot = { # attempted to manually set zpool, didn't work flags = "-k -p -P ${service_configs.zpool}"; enable = true; frequent = 4; # 15-minutes hourly = 24; daily = 7; weekly = 4; monthly = 12; }; }; }