Files
nixpkgs/nixos/modules/tasks/bcache.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

41 lines
1.1 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.boot.bcache;
in
{
options.boot.bcache.enable = lib.mkEnableOption "bcache mount support" // {
default = true;
example = false;
};
options.boot.initrd.services.bcache.enable = lib.mkEnableOption "bcache support in the initrd" // {
description = ''
*This will only be used when systemd is used in stage 1.*
Whether to enable bcache support in the initrd.
'';
default = config.boot.initrd.systemd.enable && config.boot.bcache.enable;
defaultText = lib.literalExpression "config.boot.initrd.systemd.enable && config.boot.bcache.enable";
};
config = lib.mkIf cfg.enable {
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 ];
};
};
}