2022-04-16 22:46:32 +03:00
|
|
|
{ config, lib, pkgs, ... }:
|
2014-11-11 00:09:34 +03:00
|
|
|
|
|
|
|
{
|
2022-04-16 22:46:32 +03:00
|
|
|
options.boot.initrd.services.bcache.enable = (lib.mkEnableOption "bcache support in the initrd") // {
|
|
|
|
visible = false; # only works with systemd stage 1
|
|
|
|
};
|
2014-11-11 00:09:34 +03:00
|
|
|
|
2022-04-16 22:46:32 +03:00
|
|
|
config = {
|
2014-11-11 00:09:34 +03:00
|
|
|
|
2022-04-16 22:46:32 +03:00
|
|
|
environment.systemPackages = [ pkgs.bcache-tools ];
|
2017-06-01 23:45:41 +03:00
|
|
|
|
2022-04-16 22:46:32 +03:00
|
|
|
services.udev.packages = [ pkgs.bcache-tools ];
|
2014-11-11 00:09:34 +03:00
|
|
|
|
2022-04-16 22:46:32 +03: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-11 00:09:34 +03:00
|
|
|
}
|