diff --git a/example/swap.nix b/example/swap.nix index 14ec861..8d5d8d6 100644 --- a/example/swap.nix +++ b/example/swap.nix @@ -38,6 +38,7 @@ content = { type = "swap"; randomEncryption = true; + resumeDevice = true; # resume from hiberation from this device }; } ]; diff --git a/lib/types/swap.nix b/lib/types/swap.nix index 688e914..8c6a5cf 100644 --- a/lib/types/swap.nix +++ b/lib/types/swap.nix @@ -16,6 +16,11 @@ default = false; description = "Whether to randomly encrypt the swap"; }; + resumeDevice = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Whether to use this as a boot.resumeDevice"; + }; _parent = lib.mkOption { internal = true; default = parent; @@ -51,6 +56,7 @@ device = config.device; randomEncryption = config.randomEncryption; }]; + boot.resumeDevice = lib.mkIf config.resumeDevice dev; }]; description = "NixOS configuration"; };