Merge pull request #191491 from oxalica/fix/systemd-initrd-modprobe

nixos/systemd-stage-1: include modprobe confg in initrd
This commit is contained in:
Florian Klink 2022-10-05 10:39:58 +02:00 committed by GitHub
commit c1c406bc87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 0 deletions

View File

@ -372,6 +372,8 @@ in {
"/etc/os-release".source = config.boot.initrd.osRelease;
"/etc/initrd-release".source = config.boot.initrd.osRelease;
} // optionalAttrs (config.environment.etc ? "modprobe.d/nixos.conf") {
"/etc/modprobe.d/nixos.conf".source = config.environment.etc."modprobe.d/nixos.conf".source;
};
storePaths = [

View File

@ -597,6 +597,7 @@ in {
systemd-initrd-btrfs-raid = handleTest ./systemd-initrd-btrfs-raid.nix {};
systemd-initrd-luks-keyfile = handleTest ./systemd-initrd-luks-keyfile.nix {};
systemd-initrd-luks-password = handleTest ./systemd-initrd-luks-password.nix {};
systemd-initrd-modprobe = handleTest ./systemd-initrd-modprobe.nix {};
systemd-initrd-shutdown = handleTest ./systemd-shutdown.nix { systemdStage1 = true; };
systemd-initrd-simple = handleTest ./systemd-initrd-simple.nix {};
systemd-initrd-swraid = handleTest ./systemd-initrd-swraid.nix {};

View File

@ -0,0 +1,17 @@
import ./make-test-python.nix ({ lib, pkgs, ... }: {
name = "systemd-initrd-modprobe";
nodes.machine = { pkgs, ... }: {
boot.initrd.systemd.enable = true;
boot.initrd.kernelModules = [ "loop" ]; # Load module in initrd.
boot.extraModprobeConfig = ''
options loop max_loop=42
'';
};
testScript = ''
machine.wait_for_unit("multi-user.target")
max_loop = machine.succeed("cat /sys/module/loop/parameters/max_loop")
assert int(max_loop) == 42, "Parameter should be respected for initrd kernel modules"
'';
})