about summary refs log tree commit diff
path: root/nixos/modules/tasks/filesystems
diff options
context:
space:
mode:
authorBryan A. S <bryanasdev000@gmail.com>2022-05-05 11:42:44 -0300
committerBryan A. S <bryanasdev000@gmail.com>2022-10-29 04:46:27 -0300
commita53858010b576291eda47035fbaa77ab40bf33c7 (patch)
treef7144969496bd6056a1f7cfd7457c9a5c39fc353 /nixos/modules/tasks/filesystems
parent956e35d0b10cd48df91e1b4e2c928efe178335ed (diff)
downloadnixlib-a53858010b576291eda47035fbaa77ab40bf33c7.tar
nixlib-a53858010b576291eda47035fbaa77ab40bf33c7.tar.gz
nixlib-a53858010b576291eda47035fbaa77ab40bf33c7.tar.bz2
nixlib-a53858010b576291eda47035fbaa77ab40bf33c7.tar.lz
nixlib-a53858010b576291eda47035fbaa77ab40bf33c7.tar.xz
nixlib-a53858010b576291eda47035fbaa77ab40bf33c7.tar.zst
nixlib-a53858010b576291eda47035fbaa77ab40bf33c7.zip
nixos/zfs: introduce option to control hibernation
Diffstat (limited to 'nixos/modules/tasks/filesystems')
-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 96222f3b4f64..4b4f4cc801ab 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