sanoid: keep monthly snapshots (and hopefully bookmarks)
[sourcephile-nix.git] / nixos / profiles / systems / zfs.nix
index af720d08d38820d16903dab3ba39b230d91c20d3..634c1ad42675f4a23611aefef1578fd3e10b1d90 100644 (file)
@@ -10,13 +10,30 @@ services.udev.extraRules = ''
 
 boot.supportedFilesystems = [ "zfs" ];
 
+# Using ZFS together with hibernation (suspend to disk)
+# may cause filesystem corruption.
+# See https://github.com/openzfs/zfs/issues/260
+boot.kernelParams = [ "nohibernate" ];
+
 # Ensure extra safeguards are active that zfs uses to protect zfs pools.
 boot.zfs.forceImportAll  = false;
 boot.zfs.forceImportRoot = false;
 
-boot.zfs.enableUnstable = true;
-boot.zfs.requestEncryptionCredentials = true;
+boot.zfs.enableUnstable = false;
+# Can be overrided with a list of specific datasets
+boot.zfs.requestEncryptionCredentials = lib.mkDefault true;
 
 # Enables periodic scrubbing of ZFS pools.
 services.zfs.autoScrub.enable = true;
+
+# According to zpool(8), for consumer hardware
+# periodic manual TRIM is preferred over the automatic TRIM
+# that ZFS implements.
+services.zfs.trim.enable = true;
+
+# Add tools useful with zfs send/receive
+environment.systemPackages = [
+  pkgs.lzop
+  pkgs.mbuffer
+];
 }