mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 06:45:16 +01:00
bd56368848
most of these are hidden because they're either part of a submodule that doesn't have its type rendered (eg because the submodule type is used in an either type) or because they are explicitly hidden. some of them are merely hidden from nix-doc-munge by how their option is put together.
43 lines
1.2 KiB
Nix
43 lines
1.2 KiB
Nix
{ config, pkgs, lib, ... }: let
|
|
|
|
cfg = config.boot.initrd.services.swraid;
|
|
|
|
in {
|
|
|
|
options.boot.initrd.services.swraid = {
|
|
enable = (lib.mkEnableOption (lib.mdDoc "swraid support using mdadm")) // {
|
|
visible = false; # only has effect when the new stage 1 is in place
|
|
};
|
|
|
|
mdadmConf = lib.mkOption {
|
|
description = lib.mdDoc "Contents of {file}`/etc/mdadm.conf` in initrd.";
|
|
type = lib.types.lines;
|
|
default = "";
|
|
};
|
|
};
|
|
|
|
config = {
|
|
environment.systemPackages = [ pkgs.mdadm ];
|
|
|
|
services.udev.packages = [ pkgs.mdadm ];
|
|
|
|
systemd.packages = [ pkgs.mdadm ];
|
|
|
|
boot.initrd.availableKernelModules = lib.mkIf (config.boot.initrd.systemd.enable -> cfg.enable) [ "md_mod" "raid0" "raid1" "raid10" "raid456" ];
|
|
|
|
boot.initrd.extraUdevRulesCommands = lib.mkIf (!config.boot.initrd.systemd.enable) ''
|
|
cp -v ${pkgs.mdadm}/lib/udev/rules.d/*.rules $out/
|
|
'';
|
|
|
|
boot.initrd.systemd = lib.mkIf cfg.enable {
|
|
contents."/etc/mdadm.conf" = lib.mkIf (cfg.mdadmConf != "") {
|
|
text = cfg.mdadmConf;
|
|
};
|
|
|
|
packages = [ pkgs.mdadm ];
|
|
initrdBin = [ pkgs.mdadm ];
|
|
};
|
|
|
|
boot.initrd.services.udev.packages = lib.mkIf cfg.enable [ pkgs.mdadm ];
|
|
};
|
|
}
|