2022-04-16 20:46:32 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2014-11-10 21:09:34 +00:00
|
|
|
|
|
|
|
{
|
2022-04-16 20:46:32 +01:00
|
|
|
options.boot.initrd.services.bcache.enable = (lib.mkEnableOption "bcache support in the initrd") // {
|
|
|
|
visible = false; # only works with systemd stage 1
|
|
|
|
};
|
2014-11-10 21:09:34 +00:00
|
|
|
|
2022-04-16 20:46:32 +01:00
|
|
|
config = {
|
2014-11-10 21:09:34 +00:00
|
|
|
|
2022-04-16 20:46:32 +01:00
|
|
|
environment.systemPackages = [ pkgs.bcache-tools ];
|
2017-06-01 21:45:41 +01:00
|
|
|
|
2022-04-16 20:46:32 +01:00
|
|
|
services.udev.packages = [ pkgs.bcache-tools ];
|
2014-11-10 21:09:34 +00:00
|
|
|
|
2022-04-16 20:46:32 +01:00
|
|
|
boot.initrd.extraUdevRulesCommands = lib.mkIf (!config.boot.initrd.systemd.enable) ''
|
|
|
|
cp -v ${pkgs.bcache-tools}/lib/udev/rules.d/*.rules $out/
|
|
|
|
'';
|
|
|
|
|
|
|
|
boot.initrd.services.udev = lib.mkIf config.boot.initrd.services.bcache.enable {
|
|
|
|
packages = [ pkgs.bcache-tools ];
|
|
|
|
binPackages = [ pkgs.bcache-tools ];
|
|
|
|
};
|
|
|
|
};
|
2014-11-10 21:09:34 +00:00
|
|
|
}
|