From 876969d793430ead6f946f4449cf032a9aaa4011 Mon Sep 17 00:00:00 2001 From: Technofab Date: Tue, 20 Jun 2023 20:48:02 +0200 Subject: [PATCH] feat(swap): add resumeDevice option which sets boot.resumeDevice --- example/swap.nix | 1 + lib/types/swap.nix | 6 ++++++ 2 files changed, 7 insertions(+) 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"; };