From 39b4091769fd4c7974c6866e9c8448da92e45ccf Mon Sep 17 00:00:00 2001 From: Sergey Kazenyuk Date: Tue, 23 Jan 2024 02:16:25 +0300 Subject: [PATCH] swap: add mountOptions --- lib/types/swap.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/types/swap.nix b/lib/types/swap.nix index ca544b6..cdffde6 100644 --- a/lib/types/swap.nix +++ b/lib/types/swap.nix @@ -28,6 +28,12 @@ default = [ ]; description = "Extra arguments"; }; + mountOptions = lib.mkOption { + type = lib.types.listOf lib.types.nonEmptyStr; + default = [ "defaults" ]; + example = [ "nofail" ]; + description = "Options used to mount the swap."; + }; priority = lib.mkOption { type = lib.types.nullOr lib.types.int; default = null; @@ -82,7 +88,9 @@ }"} ${ lib.optionalString (config.priority != null) "--priority=${toString config.priority}" - } ${config.device} + } \ + --options=${lib.concatStringsSep "," config.mountOptions} \ + ${config.device} fi ''; }; @@ -99,6 +107,7 @@ # forward discard/TRIM attempts through dm-crypt allowDiscards = config.discardPolicy != null; }; + options = config.mountOptions; }]; boot.resumeDevice = lib.mkIf config.resumeDevice config.device; }];