about summary refs log tree commit diff
path: root/nixos/modules/tasks
diff options
context:
space:
mode:
authorThiago Kenji Okada <thiagokokada@gmail.com>2022-10-29 10:37:52 +0100
committerGitHub <noreply@github.com>2022-10-29 10:37:52 +0100
commitf83198ab9cb588a9a5efaefdab2a078911951cdc (patch)
treece59ebe0c000c5dc0bd7e3b0dc6d93452b845a4e /nixos/modules/tasks
parent60b1608ad793c763ffbeabddc95dba7b4ed9cbc8 (diff)
parenta53858010b576291eda47035fbaa77ab40bf33c7 (diff)
Merge pull request #171680 from bryanasdev000/zfshibernation
nixos/zfs: introduce option to control hibernation
Diffstat (limited to 'nixos/modules/tasks')
-rw-r--r--nixos/modules/tasks/filesystems/zfs.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix
index 96222f3b4f645..4b4f4cc801aba 100644
--- a/nixos/modules/tasks/filesystems/zfs.nix
+++ b/nixos/modules/tasks/filesystems/zfs.nix
@@ -226,6 +226,15 @@ in
           '';
       };
 
+      allowHibernation = mkOption {
+        type = types.bool;
+        default = false;
+        description = lib.mdDoc ''
+          Allow hibernation support, this may be a unsafe option depending on your
+          setup. Make sure to NOT use Swap on ZFS.
+        '';
+      };
+
       extraPools = mkOption {
         type = types.listOf types.str;
         default = [];
@@ -498,6 +507,10 @@ in
 
       boot = {
         kernelModules = [ "zfs" ];
+        # https://github.com/openzfs/zfs/issues/260
+        # https://github.com/openzfs/zfs/issues/12842
+        # https://github.com/NixOS/nixpkgs/issues/106093
+        kernelParams = lib.optionals (!config.boot.zfs.allowHibernation) [ "nohibernate" ];
 
         extraModulePackages = [
           (if config.boot.zfs.enableUnstable then