git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commit4755811a12c11b5ed6f6ccd6036526d5869d9b17 authorBjørn Forsman <bjorn.forsman@gmail.com> dateMon 10 Jun 2019, 21:12 (7 years ago) parentc58b5f6
1 file changed+5
nixos/modules/installer/tools/nixos-generate-config.pl+5
nixos/modules/installer/tools/nixos-generate-config.pl+5
@@ -258,6 +258,11 @@ foreach my $path (glob "/sys/class/{block,mmc_host}/*") {
258258 }
259259}
260260
261+# Add bcache module, if needed.
262+my @bcacheDevices = glob("/dev/bcache*");
263+if (scalar @bcacheDevices > 0) {
264+ push @initrdAvailableKernelModules, "bcache";
265+}
261266
262267my $virt = `systemd-detect-virt`;
263268chomp $virt;