mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 05:43:50 +03:00
Merge pull request #49835 from Synthetica9/fix-49826
nixos-generate-config: fix for swapless kernels
This commit is contained in:
commit
5c4ed80ad7
@ -314,14 +314,16 @@ push @attrs, "services.xserver.videoDrivers = [ \"$videoDriver\" ];" if $videoDr
|
|||||||
|
|
||||||
# Generate the swapDevices option from the currently activated swap
|
# Generate the swapDevices option from the currently activated swap
|
||||||
# devices.
|
# devices.
|
||||||
my @swaps = read_file("/proc/swaps");
|
my @swaps = read_file("/proc/swaps", err_mode => 'carp');
|
||||||
shift @swaps;
|
|
||||||
my @swapDevices;
|
my @swapDevices;
|
||||||
foreach my $swap (@swaps) {
|
if (@swaps) {
|
||||||
|
shift @swaps;
|
||||||
|
foreach my $swap (@swaps) {
|
||||||
$swap =~ /^(\S+)\s/;
|
$swap =~ /^(\S+)\s/;
|
||||||
next unless -e $1;
|
next unless -e $1;
|
||||||
my $dev = findStableDevPath $1;
|
my $dev = findStableDevPath $1;
|
||||||
push @swapDevices, "{ device = \"$dev\"; }";
|
push @swapDevices, "{ device = \"$dev\"; }";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user