nixos-generate-config: add support for bcache

Add "bcache" to boot.initrd.availableKernelModules if a bcache device is
detected.

This fixes a problem I've had one too many times: I install NixOS and
forget to add "bcache", resulting in an unbootable machine (until fixed
with Live CD). Now NixOS will do it for me.
This commit is contained in:
Bjørn Forsman 2019-06-10 21:12:01 +02:00
parent c58b5f6f4b
commit 4755811a12

View file

@ -258,6 +258,11 @@ foreach my $path (glob "/sys/class/{block,mmc_host}/*") {
}
}
# Add bcache module, if needed.
my @bcacheDevices = glob("/dev/bcache*");
if (scalar @bcacheDevices > 0) {
push @initrdAvailableKernelModules, "bcache";
}
my $virt = `systemd-detect-virt`;
chomp $virt;