2022-04-27 09:35:20 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
{
|
2023-07-15 17:15:38 +00:00
|
|
|
options.boot.initrd.services.bcache.enable = lib.mkEnableOption (lib.mdDoc "bcache support in the initrd") // {
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
*This will only be used when systemd is used in stage 1.*
|
|
|
|
|
|
|
|
Whether to enable bcache support in the initrd.
|
|
|
|
'';
|
2022-04-27 09:35:20 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
config = {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
environment.systemPackages = [ pkgs.bcache-tools ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
services.udev.packages = [ pkgs.bcache-tools ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-27 09:35:20 +00: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 ];
|
|
|
|
};
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
}
|