mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 14:10:33 +03:00
nixos/stage-1-systemd: Add mdraid support (+ test)
This commit is contained in:
parent
65cc198539
commit
dda7e9e3ee
5 changed files with 89 additions and 10 deletions
|
@ -355,7 +355,7 @@ let
|
|||
[ { object = bootStage1;
|
||||
symlink = "/init";
|
||||
}
|
||||
{ object = pkgs.writeText "mdadm.conf" config.boot.initrd.mdadmConf;
|
||||
{ object = pkgs.writeText "mdadm.conf" config.boot.initrd.services.mdraid.mdadmConf;
|
||||
symlink = "/etc/mdadm.conf";
|
||||
}
|
||||
{ object = pkgs.runCommand "initrd-kmod-blacklist-ubuntu" {
|
||||
|
@ -505,14 +505,6 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
boot.initrd.mdadmConf = mkOption {
|
||||
default = "";
|
||||
type = types.lines;
|
||||
description = ''
|
||||
Contents of <filename>/etc/mdadm.conf</filename> in stage 1.
|
||||
'';
|
||||
};
|
||||
|
||||
boot.initrd.preLVMCommands = mkOption {
|
||||
default = "";
|
||||
type = types.lines;
|
||||
|
@ -736,6 +728,9 @@ in
|
|||
];
|
||||
|
||||
boot.initrd.supportedFilesystems = map (fs: fs.fsType) fileSystems;
|
||||
|
||||
};
|
||||
|
||||
imports = [
|
||||
(mkRenamedOptionModule [ "boot" "initrd" "mdadmConf" ] [ "boot" "initrd" "services" "mdraid" "mdadmConf" ])
|
||||
];
|
||||
}
|
||||
|
|
32
nixos/modules/system/boot/systemd/initrd-mdraid.nix
Normal file
32
nixos/modules/system/boot/systemd/initrd-mdraid.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{ config, pkgs, lib, ... }: let
|
||||
|
||||
cfg = config.boot.initrd.services.mdraid;
|
||||
|
||||
in {
|
||||
options.boot.initrd.services.mdraid = {
|
||||
enable = (lib.mkEnableOption "mdraid support in initrd") // {
|
||||
visible = false;
|
||||
};
|
||||
|
||||
mdadmConf = lib.mkOption {
|
||||
description = "Contents of <filename>/etc/mdadm.conf</filename> in initrd.";
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.boot.initrd.systemd.enable && cfg.enable) {
|
||||
boot.initrd.systemd = {
|
||||
contents."/etc/mdadm.conf" = lib.mkIf (cfg.mdadmConf != "") {
|
||||
text = cfg.mdadmConf;
|
||||
};
|
||||
|
||||
initrdBin = [ pkgs.mdadm ];
|
||||
};
|
||||
|
||||
boot.initrd.services.udev.packages = [ pkgs.mdadm ];
|
||||
boot.initrd.systemd.packages = [ pkgs.mdadm ];
|
||||
|
||||
boot.kernelModules = [ "dm-raid" ];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue