Merge pull request #300995 from SuperSandro2000/udev-nixos-wsl
nixos/udev: make more NixOS WSL friendly
This commit is contained in:
commit
3814255973
|
@ -401,17 +401,19 @@ in
|
||||||
}))
|
}))
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.etc =
|
environment.etc = {
|
||||||
{
|
"udev/rules.d".source = udevRulesFor {
|
||||||
"udev/rules.d".source = udevRulesFor {
|
name = "udev-rules";
|
||||||
name = "udev-rules";
|
udevPackages = cfg.packages;
|
||||||
udevPackages = cfg.packages;
|
systemd = config.systemd.package;
|
||||||
systemd = config.systemd.package;
|
binPackages = cfg.packages;
|
||||||
binPackages = cfg.packages;
|
inherit udevPath udev;
|
||||||
inherit udevPath udev;
|
|
||||||
};
|
|
||||||
"udev/hwdb.bin".source = hwdbBin;
|
|
||||||
};
|
};
|
||||||
|
"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; [
|
system.requiredKernelConfig = with config.lib.kernelConfig; [
|
||||||
(isEnabled "UNIX")
|
(isEnabled "UNIX")
|
||||||
|
@ -419,21 +421,17 @@ in
|
||||||
(isYes "NET")
|
(isYes "NET")
|
||||||
];
|
];
|
||||||
|
|
||||||
# We don't place this into `extraModprobeConfig` so that stage-1 ramdisk doesn't bloat.
|
system.activationScripts.udevd = lib.mkIf config.boot.kernel.enable ''
|
||||||
environment.etc."modprobe.d/firmware.conf".text = "options firmware_class path=${config.hardware.firmware}/lib/firmware";
|
# 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 =
|
# Allow the kernel to find our firmware.
|
||||||
''
|
if [ -e /sys/module/firmware_class/parameters/path ]; then
|
||||||
# The deprecated hotplug uevent helper is not used anymore
|
echo -n "${config.hardware.firmware}/lib/firmware" > /sys/module/firmware_class/parameters/path
|
||||||
if [ -e /proc/sys/kernel/hotplug ]; then
|
fi
|
||||||
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
|
|
||||||
'';
|
|
||||||
|
|
||||||
systemd.services.systemd-udevd =
|
systemd.services.systemd-udevd =
|
||||||
{ restartTriggers = cfg.packages;
|
{ restartTriggers = cfg.packages;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user