diff options
-rw-r--r-- | nixos/doc/manual/from_md/release-notes/rl-2205.section.xml | 8 | ||||
-rw-r--r-- | nixos/doc/manual/release-notes/rl-2205.section.md | 2 | ||||
-rw-r--r-- | nixos/modules/system/boot/modprobe.nix | 20 | ||||
-rw-r--r-- | nixos/modules/system/boot/stage-1.nix | 3 |
4 files changed, 33 insertions, 0 deletions
diff --git a/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml index ea2388c1bdb..d1692c66a4b 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml @@ -609,6 +609,14 @@ </listitem> <listitem> <para> + A new option + <literal>boot.initrd.extraModprobeConfig</literal> has been + added which can be used to configure kernel modules that are + loaded in the initrd. + </para> + </listitem> + <listitem> + <para> <literal>fetchFromSourcehut</literal> now allows fetching repositories recursively using <literal>fetchgit</literal> or <literal>fetchhg</literal> if the argument diff --git a/nixos/doc/manual/release-notes/rl-2205.section.md b/nixos/doc/manual/release-notes/rl-2205.section.md index 673a82a408c..f2484c911e7 100644 --- a/nixos/doc/manual/release-notes/rl-2205.section.md +++ b/nixos/doc/manual/release-notes/rl-2205.section.md @@ -211,6 +211,8 @@ In addition to numerous new and upgraded packages, this release has the followin - The option `services.duplicati.dataDir` has been added to allow changing the location of duplicati's files. +- A new option `boot.initrd.extraModprobeConfig` has been added which can be used to configure kernel modules that are loaded in the initrd. + - `fetchFromSourcehut` now allows fetching repositories recursively using `fetchgit` or `fetchhg` if the argument `fetchSubmodules` is set to `true`. diff --git a/nixos/modules/system/boot/modprobe.nix b/nixos/modules/system/boot/modprobe.nix index c75f32c4d99..7426d148891 100644 --- a/nixos/modules/system/boot/modprobe.nix +++ b/nixos/modules/system/boot/modprobe.nix @@ -34,6 +34,23 @@ with lib; type = types.lines; }; + boot.initrd.extraModprobeConfig = mkOption { + default = ""; + example = + '' + options zfs zfs_arc_max=1073741824 + ''; + description = '' + Does exactly the same thing as + <option>boot.extraModprobeConfig</option>, except + that the generated <filename>modprobe.conf</filename> + file is also included in the initrd. + This is useful for setting module options for kernel + modules that are loaded during early boot in the initrd. + ''; + type = types.lines; + }; + }; @@ -50,6 +67,9 @@ with lib; '')} ${config.boot.extraModprobeConfig} ''; + environment.etc."modprobe.d/nixos-initrd.conf".text = '' + ${config.boot.initrd.extraModprobeConfig} + ''; environment.etc."modprobe.d/debian.conf".source = pkgs.kmod-debian-aliases; environment.systemPackages = [ pkgs.kmod ]; diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix index 6dfe6b939ab..9c684fbada2 100644 --- a/nixos/modules/system/boot/stage-1.nix +++ b/nixos/modules/system/boot/stage-1.nix @@ -338,6 +338,9 @@ let { object = pkgs.writeText "mdadm.conf" config.boot.initrd.mdadmConf; symlink = "/etc/mdadm.conf"; } + { object = config.environment.etc."modprobe.d/nixos-initrd.conf".source; + symlink = "/etc/modprobe.d/nixos-initrd.conf"; + } { object = pkgs.runCommand "initrd-kmod-blacklist-ubuntu" { src = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf"; preferLocalBuild = true; |