nixos-generate-config: prefer /dev/mapper paths for mounts

Currently, we generate `/dev/disk/by-uuid` paths for encrypted LUKS
volumes, which makes it impossible to determine that they are waiting
on a Device Mapper device at boot. Using `/dev/mapper` paths ensures
that systemd stage 1 waives its standard mount timeout for these
volumes to allow the user more time to enter the LUKS password.
This commit is contained in:
Emily
2025-07-13 12:39:52 +01:00
parent bdcd26285b
commit 8115e2b01a
@@ -344,7 +344,12 @@ sub findStableDevPath {
my $st = stat($dev) or return $dev;
foreach my $dev2 (glob("/dev/stratis/*/*"), glob("/dev/disk/by-uuid/*"), glob("/dev/mapper/*"), glob("/dev/disk/by-label/*")) {
foreach my $dev2 (
glob("/dev/stratis/*/*"),
glob("/dev/mapper/*"),
glob("/dev/disk/by-uuid/*"),
glob("/dev/disk/by-label/*"),
) {
my $st2 = stat($dev2) or next;
return $dev2 if $st->rdev == $st2->rdev;
}