about summary refs log tree commit diff
path: root/nixpkgs/nixos/modules/tasks/bcache.nix
blob: 0a13522de11f0fdcd79d19edd7f333a9bd2defd7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{ config, lib, pkgs, ... }:

{
  options.boot.initrd.services.bcache.enable = (lib.mkEnableOption "bcache support in the initrd") // {
    visible = false; # only works with systemd stage 1
  };

  config = {

    environment.systemPackages = [ pkgs.bcache-tools ];

    services.udev.packages = [ pkgs.bcache-tools ];

    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 ];
    };
  };
}