From 078e9dd9844efc0c2004ce2bac10602af5a9af17 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Mon, 3 Feb 2025 21:47:07 -0500 Subject: [PATCH] services.sanoid --- zfs.nix | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/zfs.nix b/zfs.nix index eeeb39b..fe8cef1 100644 --- a/zfs.nix +++ b/zfs.nix @@ -26,20 +26,31 @@ in boot.supportedFilesystems = [ "zfs" ]; boot.zfs.extraPools = [ service_configs.zpool ]; + services.sanoid = { + enable = true; + datasets."${service_configs.zpool}" = { + recursive = true; + autoprune = true; + autosnap = true; + hourly = 24; + daily = 30; + monthly = 12; + yearly = 4; + }; + + datasets."${service_configs.zpool}/services/sql" = { + recursive = true; + autoprune = true; + autosnap = true; + hourly = 12; + daily = 2; + monthly = 0; + yearly = 0; + }; + }; + 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; - }; }; }