summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services/hardware/udev.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services/hardware/udev.nix')
-rw-r--r--nixos/modules/services/hardware/udev.nix46
1 files changed, 22 insertions, 24 deletions
diff --git a/nixos/modules/services/hardware/udev.nix b/nixos/modules/services/hardware/udev.nix
index 4f8ca85a7432..3db661644281 100644
--- a/nixos/modules/services/hardware/udev.nix
+++ b/nixos/modules/services/hardware/udev.nix
@@ -401,17 +401,19 @@ in
}))
];
- environment.etc =
- {
- "udev/rules.d".source = udevRulesFor {
- name = "udev-rules";
- udevPackages = cfg.packages;
- systemd = config.systemd.package;
- binPackages = cfg.packages;
- inherit udevPath udev;
- };
- "udev/hwdb.bin".source = hwdbBin;
+ environment.etc = {
+ "udev/rules.d".source = udevRulesFor {
+ name = "udev-rules";
+ udevPackages = cfg.packages;
+ systemd = config.systemd.package;
+ binPackages = cfg.packages;
+ inherit udevPath udev;
};
+ "udev/hwdb.bin".source = hwdbBin;
+ } // lib.optionalAttrs config.boot.modprobeConfig.enable {
+ # We don't place this into `extraModprobeConfig` so that stage-1 ramdisk doesn't bloat.
+ "modprobe.d/firmware.conf".text = "options firmware_class path=${config.hardware.firmware}/lib/firmware";
+ };
system.requiredKernelConfig = with config.lib.kernelConfig; [
(isEnabled "UNIX")
@@ -419,21 +421,17 @@ in
(isYes "NET")
];
- # We don't place this into `extraModprobeConfig` so that stage-1 ramdisk doesn't bloat.
- environment.etc."modprobe.d/firmware.conf".text = "options firmware_class path=${config.hardware.firmware}/lib/firmware";
-
- system.activationScripts.udevd =
- ''
- # The deprecated hotplug uevent helper is not used anymore
- if [ -e /proc/sys/kernel/hotplug ]; then
- echo "" > /proc/sys/kernel/hotplug
- fi
+ system.activationScripts.udevd = lib.mkIf config.boot.kernel.enable ''
+ # The deprecated hotplug uevent helper is not used anymore
+ if [ -e /proc/sys/kernel/hotplug ]; then
+ echo "" > /proc/sys/kernel/hotplug
+ fi
- # Allow the kernel to find our firmware.
- if [ -e /sys/module/firmware_class/parameters/path ]; then
- echo -n "${config.hardware.firmware}/lib/firmware" > /sys/module/firmware_class/parameters/path
- fi
- '';
+ # Allow the kernel to find our firmware.
+ if [ -e /sys/module/firmware_class/parameters/path ]; then
+ echo -n "${config.hardware.firmware}/lib/firmware" > /sys/module/firmware_class/parameters/path
+ fi
+ '';
systemd.services.systemd-udevd =
{ restartTriggers = cfg.packages;