diff --git a/modules/services/hardware/udev.nix b/modules/services/hardware/udev.nix index e7c9d84033c9..e34d52a4ed5c 100644 --- a/modules/services/hardware/udev.nix +++ b/modules/services/hardware/udev.nix @@ -134,7 +134,7 @@ in hardware.firmware = mkOption { default = []; - example = ["/root/my-firmware"]; + example = [/root/my-firmware]; merge = mergeListOption; description = '' List of directories containing firmware files. Such files @@ -142,6 +142,11 @@ in (i.e., when it has detected specific hardware that requires firmware to function). ''; + apply = list: pkgs.buildEnv { + name = "firmware"; + paths = list; + pathsToLink = [ "/" ]; + }; }; }; @@ -157,7 +162,8 @@ in # As a fallback, allow firmware to be placed in # /root/test-firmware (primarily for testing). - hardware.firmware = [ "/root/test-firmware" ]; + hardware.firmware = pkgs.lib.optional + (builtins.pathExists /root/test-firmware) /root/test-firmware; jobs.udev = { startOn = "startup"; diff --git a/modules/system/activation/top-level.nix b/modules/system/activation/top-level.nix index 0128ffb0c261..8cd23cd933da 100644 --- a/modules/system/activation/top-level.nix +++ b/modules/system/activation/top-level.nix @@ -79,6 +79,7 @@ let ln -s ${config.system.build.etc}/etc $out/etc ln -s ${config.system.path} $out/sw ln -s ${config.system.build.upstart} $out/upstart + ln -s ${config.hardware.firmware} $out/firmware echo "$kernelParams" > $out/kernel-params echo "$configurationName" > $out/configuration-name