at 24.11-pre 934 B view raw
1{ config, lib, pkgs, ... }: let 2 cfg = config.boot.bcache; 3in { 4 options.boot.bcache.enable = lib.mkEnableOption "bcache mount support" // { 5 default = true; 6 example = false; 7 }; 8 options.boot.initrd.services.bcache.enable = lib.mkEnableOption "bcache support in the initrd" // { 9 description = '' 10 *This will only be used when systemd is used in stage 1.* 11 12 Whether to enable bcache support in the initrd. 13 ''; 14 }; 15 16 config = lib.mkIf cfg.enable { 17 18 environment.systemPackages = [ pkgs.bcache-tools ]; 19 20 services.udev.packages = [ pkgs.bcache-tools ]; 21 22 boot.initrd.extraUdevRulesCommands = lib.mkIf (!config.boot.initrd.systemd.enable) '' 23 cp -v ${pkgs.bcache-tools}/lib/udev/rules.d/*.rules $out/ 24 ''; 25 26 boot.initrd.services.udev = lib.mkIf config.boot.initrd.services.bcache.enable { 27 packages = [ pkgs.bcache-tools ]; 28 binPackages = [ pkgs.bcache-tools ]; 29 }; 30 }; 31}