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.
16 config = lib.mkIf cfg.enable {
18 environment.systemPackages = [ pkgs.bcache-tools ];
20 services.udev.packages = [ pkgs.bcache-tools ];
22 boot.initrd.extraUdevRulesCommands = lib.mkIf (!config.boot.initrd.systemd.enable) ''
23 cp -v ${pkgs.bcache-tools}/lib/udev/rules.d/*.rules $out/
26 boot.initrd.services.udev = lib.mkIf config.boot.initrd.services.bcache.enable {
27 packages = [ pkgs.bcache-tools ];
28 binPackages = [ pkgs.bcache-tools ];