summary refs log tree commit diff
path: root/modules/services/hardware/udev.nix
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2013-03-04 09:42:03 -0500
committerShea Levy <shea@shealevy.com>2013-03-04 09:42:03 -0500
commit70378ad2b7bcc2995e234d6854cfd9790ba5b789 (patch)
tree79a6eb835996b803c93405ed5270771e8e7db8ec /modules/services/hardware/udev.nix
parent5737604b13ce1add83870d085633b5cad132327a (diff)
downloadnixpkgs-70378ad2b7bcc2995e234d6854cfd9790ba5b789.tar
nixpkgs-70378ad2b7bcc2995e234d6854cfd9790ba5b789.tar.gz
nixpkgs-70378ad2b7bcc2995e234d6854cfd9790ba5b789.tar.bz2
nixpkgs-70378ad2b7bcc2995e234d6854cfd9790ba5b789.tar.lz
nixpkgs-70378ad2b7bcc2995e234d6854cfd9790ba5b789.tar.xz
nixpkgs-70378ad2b7bcc2995e234d6854cfd9790ba5b789.tar.zst
nixpkgs-70378ad2b7bcc2995e234d6854cfd9790ba5b789.zip
Add our firmware path to the in-kernel lookup path
Newer kernels (since torvalds/linux@abb139e75c2cdbb955e840d6331cb5863e409d0e) try to
read firmware directly from the filesystem before falling back to a
userspace helper (udev) if firmware cannot be found (in even newer
kernels, the fallback path can be disabled altogether). By default, only
certain paths in /lib/firmware* are searched, so this was initially not
helpful for NixOS.

Since torvalds/linux@27602842060484b564cd725241b402b0bddfb830 (which,
based on the commit message, was implemented just for NixOS, go us!),
though, an extra path can be dynamically prepended to the search path.
So do that, in three ways:

1. Pass a kernel command line option in case the module is built-in
2. Add a line to modprobe.conf in case the module isn't yet loaded by
activation-time
3. Add an activation script to set the option in /sys in case the module
is already loaded by activation-time.
Diffstat (limited to 'modules/services/hardware/udev.nix')
-rw-r--r--modules/services/hardware/udev.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/services/hardware/udev.nix b/modules/services/hardware/udev.nix
index 0fce84fdd6d..0921997a5c9 100644
--- a/modules/services/hardware/udev.nix
+++ b/modules/services/hardware/udev.nix
@@ -227,6 +227,12 @@ in
       (isYes "INOTIFY_USER")
       (isYes "NET")
     ];
-  };
 
+    boot.extraKernelParams = [ "firmware_class.path=${config.hardware.firmware}" ];
+
+    boot.extraModprobeConfig = "options firmware_class path=${config.hardware.firmware}";
+
+    system.activationScripts."set-firmware-path" =
+      "echo -n ${config.hardware.firmware} > /sys/module/firmware_class/parameters/path";
+  };
 }