1{ config, lib, pkgs, ... }:
2
3{
4 options.boot.initrd.services.bcache.enable = (lib.mkEnableOption (lib.mdDoc "bcache support in the initrd")) // {
5 visible = false; # only works with systemd stage 1
6 };
7
8 config = {
9
10 environment.systemPackages = [ pkgs.bcache-tools ];
11
12 services.udev.packages = [ pkgs.bcache-tools ];
13
14 boot.initrd.extraUdevRulesCommands = lib.mkIf (!config.boot.initrd.systemd.enable) ''
15 cp -v ${pkgs.bcache-tools}/lib/udev/rules.d/*.rules $out/
16 '';
17
18 boot.initrd.services.udev = lib.mkIf config.boot.initrd.services.bcache.enable {
19 packages = [ pkgs.bcache-tools ];
20 binPackages = [ pkgs.bcache-tools ];
21 };
22 };
23}