summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@sap.com>2022-10-26 17:05:14 +0200
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2022-12-09 15:31:50 +0000
commit75d547d1ee5ac1f7e087da3021747ed50e9e3f16 (patch)
tree7582681aa43fec8d7bbc11acd344eec093898146
parentMerge pull request #205174 from NixOS/backport-205155-to-release-22.11 (diff)
downloadnixpkgs-origin/backport-197922-to-release-22.11.tar.gz
nixos/modprobe: replace boot.isContainer with boot.modprobeConfig.enableorigin/backport-197922-to-release-22.11
(cherry picked from commit f4d8e64bed05489cdb2af880644f1da4d0fe4eef)
-rw-r--r--nixos/modules/system/boot/modprobe.nix5
-rw-r--r--nixos/modules/virtualisation/container-config.nix2
2 files changed, 6 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/modprobe.nix b/nixos/modules/system/boot/modprobe.nix
index c8ab3b0d8e4a..54bb7ea9ddd7 100644
--- a/nixos/modules/system/boot/modprobe.nix
+++ b/nixos/modules/system/boot/modprobe.nix
@@ -7,6 +7,9 @@ with lib;
###### interface
options = {
+ boot.modprobeConfig.enable = mkEnableOption (lib.mdDoc "modprobe config. This is useful for systemds like containers which do not require a kernel.") // {
+ default = true;
+ };
boot.blacklistedKernelModules = mkOption {
type = types.listOf types.str;
@@ -38,7 +41,7 @@ with lib;
###### implementation
- config = mkIf (!config.boot.isContainer) {
+ config = mkIf config.boot.modprobeConfig.enable {
environment.etc."modprobe.d/ubuntu.conf".source = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf";
diff --git a/nixos/modules/virtualisation/container-config.nix b/nixos/modules/virtualisation/container-config.nix
index 09a2d9de040a..f17004b08408 100644
--- a/nixos/modules/virtualisation/container-config.nix
+++ b/nixos/modules/virtualisation/container-config.nix
@@ -8,7 +8,9 @@ with lib;
# Disable some features that are not useful in a container.
+ # containers don't have a kernel
boot.kernel.enable = false;
+ boot.modprobeConfig.enable = false;
console.enable = mkDefault false;