From 099b6cca33cd283ca6b2aafe6ce96154f1b2300c Mon Sep 17 00:00:00 2001 From: Sergey Kazenyuk Date: Sat, 24 Aug 2024 21:41:26 +0300 Subject: [PATCH] btrfs: add swap priority, options --- lib/types/btrfs.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/types/btrfs.nix b/lib/types/btrfs.nix index 5d306755..1c83b0ff 100644 --- a/lib/types/btrfs.nix +++ b/lib/types/btrfs.nix @@ -13,6 +13,23 @@ let default = name; description = "Path to the swap file (relative to the mountpoint)"; }; + + priority = lib.mkOption { + type = lib.types.nullOr lib.types.int; + default = null; + description = lib.mdDoc '' + Specify the priority of the swap file. Priority is a value between 0 and 32767. + Higher numbers indicate higher priority. + null lets the kernel choose a priority, which will show up as a negative value. + ''; + }; + + options = lib.mkOption { + type = lib.types.listOf lib.types.nonEmptyStr; + default = [ "defaults" ]; + example = [ "nofail" ]; + description = "Options used to mount the swap."; + }; }; })); default = { }; @@ -24,6 +41,7 @@ let swapDevices = builtins.map (file: { device = "${mountpoint}/${file.path}"; + inherit (file) priority options; }) (lib.attrValues swap); };