From 2ca4b06bdf3ef99d417dd2764157e1b155cad2f1 Mon Sep 17 00:00:00 2001 From: ivan770 Date: Sat, 2 Mar 2024 13:08:52 -0500 Subject: [PATCH] lvm_vg: add priority option --- lib/types/lvm_vg.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/types/lvm_vg.nix b/lib/types/lvm_vg.nix index 714cb13..54d7450 100644 --- a/lib/types/lvm_vg.nix +++ b/lib/types/lvm_vg.nix @@ -19,6 +19,11 @@ default = name; description = "Name of the logical volume"; }; + priority = lib.mkOption { + type = lib.types.int; + default = if (lib.hasInfix "100%" lv.config.size) then 9001 else 1000; + description = "Priority of the logical volume, smaller values are created first"; + }; size = lib.mkOption { type = lib.types.str; # TODO lvm size type description = "Size of the logical volume"; @@ -56,7 +61,7 @@ inherit config options; default = let - sortedLvs = lib.sort (a: _: !lib.hasInfix "100%" a.size) (lib.attrValues config.lvs); + sortedLvs = lib.sort (a: b: a.priority < b.priority) (lib.attrValues config.lvs); in '' readarray -t lvm_devices < <(cat "$disko_devices_dir"/lvm_${config.name})