summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@sap.com>2022-10-26 11:18:36 +0200
committerSandro Jäckel <sandro.jaeckel@gmail.com>2022-10-26 19:24:14 +0200
commit7fe3f63da657f852a93a31108b6d058c68af884d (patch)
tree5e0f73e9571feafbb41d806c3e7bf33cf820c7a1 /nixos
parent8191089900837e16cf53348a5c66d45306986474 (diff)
downloadnixpkgs-7fe3f63da657f852a93a31108b6d058c68af884d.tar
nixpkgs-7fe3f63da657f852a93a31108b6d058c68af884d.tar.gz
nixpkgs-7fe3f63da657f852a93a31108b6d058c68af884d.tar.bz2
nixpkgs-7fe3f63da657f852a93a31108b6d058c68af884d.tar.lz
nixpkgs-7fe3f63da657f852a93a31108b6d058c68af884d.tar.xz
nixpkgs-7fe3f63da657f852a93a31108b6d058c68af884d.tar.zst
nixpkgs-7fe3f63da657f852a93a31108b6d058c68af884d.zip
nixos/udev: add enable option
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/hardware/udev.nix6
-rw-r--r--nixos/modules/virtualisation/container-config.nix3
2 files changed, 7 insertions, 2 deletions
diff --git a/nixos/modules/services/hardware/udev.nix b/nixos/modules/services/hardware/udev.nix
index 4b962da0c03..7a7f8330243 100644
--- a/nixos/modules/services/hardware/udev.nix
+++ b/nixos/modules/services/hardware/udev.nix
@@ -192,7 +192,6 @@ in
   ###### interface
 
   options = {
-
     boot.hardwareScan = mkOption {
       type = types.bool;
       default = true;
@@ -205,6 +204,9 @@ in
     };
 
     services.udev = {
+      enable = mkEnableOption (lib.mdDoc "udev") // {
+        default = true;
+      };
 
       packages = mkOption {
         type = types.listOf types.path;
@@ -345,7 +347,7 @@ in
 
   ###### implementation
 
-  config = mkIf (!config.boot.isContainer) {
+  config = mkIf cfg.enable {
 
     services.udev.extraRules = nixosRules;
 
diff --git a/nixos/modules/virtualisation/container-config.nix b/nixos/modules/virtualisation/container-config.nix
index 94f28ea80d0..a7f5044fb9c 100644
--- a/nixos/modules/virtualisation/container-config.nix
+++ b/nixos/modules/virtualisation/container-config.nix
@@ -16,6 +16,9 @@ with lib;
     # Containers should be light-weight, so start sshd on demand.
     services.openssh.startWhenNeeded = mkDefault true;
 
+    # containers do not need to setup devices
+    services.udev.enable = false;
+
     # Shut up warnings about not having a boot loader.
     system.build.installBootLoader = lib.mkDefault "${pkgs.coreutils}/bin/true";