luks: add test for multiple partitions and fix handling if on same disk (#1281)

This PR addresses the handling of multiple LUKS partitions on the same
disk and adds a corresponding test case.

- **Fix:** The core logic for handling multiple LUKS partitions on a
single disk was improved to ensure correct partition mapping and
unlocking. (Implemented using a custom pi agent and the **mimo-v2.5**
model).
- **Tests:** Added `luks-multiple` test to verify the behavior of
multiple LUKS partitions on the same disk. (Tests written by me).

Reproduces and fixes #1263
This commit is contained in:
lassulus authored and GitHub committed 2026-10-20 13:11:14 +00:00
commit 7d4804ad8d
4 files changed
+101 -14

No files matched your search

+8 -14
View File
@@ -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 {