diff options
author | Will Fancher <elvishjerricco@gmail.com> | 2023-07-13 16:24:34 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-13 16:24:34 -0400 |
commit | 11fec97761910d059a1315dbebe4e70a711a968a (patch) | |
tree | ffbffae6375c7754f39356e5543ae7423411d21e /nixos/modules/installer/tools | |
parent | 3d0e323be315beda11e941749cf65677be6631dc (diff) | |
parent | 7d2124f9e3206166d82e72990cb5637c25a42b47 (diff) | |
download | nixpkgs-11fec97761910d059a1315dbebe4e70a711a968a.tar nixpkgs-11fec97761910d059a1315dbebe4e70a711a968a.tar.gz nixpkgs-11fec97761910d059a1315dbebe4e70a711a968a.tar.bz2 nixpkgs-11fec97761910d059a1315dbebe4e70a711a968a.tar.lz nixpkgs-11fec97761910d059a1315dbebe4e70a711a968a.tar.xz nixpkgs-11fec97761910d059a1315dbebe4e70a711a968a.tar.zst nixpkgs-11fec97761910d059a1315dbebe4e70a711a968a.zip |
Merge pull request #183314 from DeterminateSystems/optional-swraid
Make swraid optional
Diffstat (limited to 'nixos/modules/installer/tools')
-rw-r--r-- | nixos/modules/installer/tools/nixos-generate-config.pl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl index 2e572ef0247..7d0c5898e23 100644 --- a/nixos/modules/installer/tools/nixos-generate-config.pl +++ b/nixos/modules/installer/tools/nixos-generate-config.pl @@ -381,6 +381,7 @@ sub in { my $fileSystems; my %fsByDev; +my $useSwraid = 0; foreach my $fs (read_file("/proc/self/mountinfo")) { chomp $fs; my @fields = split / /, $fs; @@ -510,8 +511,8 @@ EOF # boot.initrd.luks.devices entry. if (-e $device) { my $deviceName = basename(abs_path($device)); - if (-e "/sys/class/block/$deviceName" - && read_file("/sys/class/block/$deviceName/dm/uuid", err_mode => 'quiet') =~ /^CRYPT-LUKS/) + my $dmUuid = read_file("/sys/class/block/$deviceName/dm/uuid", err_mode => 'quiet'); + if ($dmUuid =~ /^CRYPT-LUKS/) { my @slaves = glob("/sys/class/block/$deviceName/slaves/*"); if (scalar @slaves == 1) { @@ -527,8 +528,14 @@ EOF } } } + if (-e "/sys/class/block/$deviceName/md/uuid") { + $useSwraid = 1; + } } } +if ($useSwraid) { + push @attrs, "boot.swraid.enable = true;\n\n"; +} # Generate the hardware configuration file. |