1 { config, lib, pkgs, ... }: let
2 cfg = config.boot.bcache;
4 options.boot.bcache.enable = lib.mkEnableOption "bcache mount support" // {
8 options.boot.initrd.services.bcache.enable = lib.mkEnableOption "bcache support in the initrd" // {
10 *This will only be used when systemd is used in stage 1.*
12 Whether to enable bcache support in the initrd.
14 default = config.boot.initrd.systemd.enable && config.boot.bcache.enable;
15 defaultText = lib.literalExpression "config.boot.initrd.systemd.enable && config.boot.bcache.enable";
18 config = lib.mkIf cfg.enable {
20 environment.systemPackages = [ pkgs.bcache-tools ];
22 services.udev.packages = [ pkgs.bcache-tools ];
24 boot.initrd.extraUdevRulesCommands = lib.mkIf (!config.boot.initrd.systemd.enable) ''
25 cp -v ${pkgs.bcache-tools}/lib/udev/rules.d/*.rules $out/
28 boot.initrd.services.udev = lib.mkIf config.boot.initrd.services.bcache.enable {
29 packages = [ pkgs.bcache-tools ];
30 binPackages = [ pkgs.bcache-tools ];