From 4677729c56baa64814a0e0cff4cf999cf543e343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Tue, 2 Apr 2024 18:14:50 +0200 Subject: [PATCH] nixos/udev: only load firmware from udev when the nixos kernel is used This is not the case for eg. NixOS in WSL --- nixos/modules/services/hardware/udev.nix | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/nixos/modules/services/hardware/udev.nix b/nixos/modules/services/hardware/udev.nix index e442f7c669dd..913babd94782 100644 --- a/nixos/modules/services/hardware/udev.nix +++ b/nixos/modules/services/hardware/udev.nix @@ -421,19 +421,17 @@ in (isYes "NET") ]; + 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 - 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 - - # 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;