From 70538c3324ad7b8a51a18ec9cc44b113c2d2b905 Mon Sep 17 00:00:00 2001 From: Maximilian Gaedig Date: Tue, 14 Jul 2026 17:42:00 +0200 Subject: [PATCH] fix: handling of multiple luks partitions on same disk fixes #1263 --- lib/types/gpt.nix | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/lib/types/gpt.nix b/lib/types/gpt.nix index 5f7b26d..a1597b3 100644 --- a/lib/types/gpt.nix +++ b/lib/types/gpt.nix @@ -342,30 +342,24 @@ in inherit config options; default = let - partMounts = lib.foldr lib.recursiveUpdate { } ( - map (partition: lib.optionalAttrs (partition.content != null) partition.content._mount) ( - lib.attrValues config.partitions - ) - ); + activePartitions = lib.filter (p: p.content != null) (lib.attrValues config.partitions); + mounts = map (p: p.content._mount) activePartitions; in { - dev = partMounts.dev or ""; - fs = partMounts.fs or { }; + dev = lib.concatStringsSep "\n" (map (m: m.dev or "") mounts); + fs = lib.foldr lib.recursiveUpdate { } (map (m: m.fs or { }) mounts); }; }; _unmount = diskoLib.mkUnmountOption { inherit config options; default = let - partMounts = lib.foldr lib.recursiveUpdate { } ( - map (partition: lib.optionalAttrs (partition.content != null) partition.content._unmount) ( - lib.attrValues config.partitions - ) - ); + activePartitions = lib.filter (p: p.content != null) (lib.attrValues config.partitions); + unmounts = map (p: p.content._unmount) activePartitions; in { - dev = partMounts.dev or ""; - fs = partMounts.fs or { }; + dev = lib.concatStringsSep "\n" (map (m: m.dev or "") unmounts); + fs = lib.foldr lib.recursiveUpdate { } (map (m: m.fs or { }) unmounts); }; }; _config = lib.mkOption {