nixpkgs/nixos/modules/tasks/bcache.nix
Lily Foster e9207b0501
nixos/*: unhide remaining systemd stage-1 options
These options were missed in NixOS/nixpkgs#226237, but they all were
specifically added for systemd stage-1.
2023-07-03 08:41:38 -04:00

28 lines
778 B
Nix

{ config, lib, pkgs, ... }:
{
options.boot.initrd.services.bcache.enable = lib.mkEnableOption (lib.mdDoc "bcache support in the initrd") // {
description = lib.mdDoc ''
*This will only be used when systemd is used in stage 1.*
Whether to enable bcache support in the initrd.
'';
};
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 ];
};
};
}