lol

Put all firmware in $out/lib/firmware

This way, hardware.firmware can be a list of packages.

+24 -28
+1 -3
nixos/modules/hardware/all-firmware.nix
··· 22 22 ###### implementation 23 23 24 24 config = mkIf config.hardware.enableAllFirmware { 25 - hardware.firmware = [ 26 - "${pkgs.firmwareLinuxNonfree}/lib/firmware" 27 - ]; 25 + hardware.firmware = [ pkgs.firmwareLinuxNonfree ]; 28 26 }; 29 27 30 28 }
+4 -4
nixos/modules/hardware/video/encoder/wis-go7007.nix
··· 5 5 in 6 6 7 7 { 8 - boot.extraModulePackages = [wis_go7007]; 8 + boot.extraModulePackages = [ wis_go7007 ]; 9 9 10 - environment.systemPackages = [wis_go7007]; 10 + environment.systemPackages = [ wis_go7007 ]; 11 11 12 - hardware.firmware = ["${wis_go7007}/firmware"]; 12 + hardware.firmware = [ wis_go7007 ]; 13 13 14 - services.udev.packages = [wis_go7007]; 14 + services.udev.packages = [ wis_go7007 ]; 15 15 }
+10 -12
nixos/modules/services/hardware/udev.nix
··· 171 171 }; 172 172 173 173 hardware.firmware = mkOption { 174 - type = types.listOf types.path; 174 + type = types.listOf types.package; 175 175 default = []; 176 176 description = '' 177 - List of directories containing firmware files. Such files 177 + List of packages containing firmware files. Such files 178 178 will be loaded automatically if the kernel asks for them 179 179 (i.e., when it has detected specific hardware that requires 180 - firmware to function). If more than one path contains a 181 - firmware file with the same name, the first path in the list 182 - takes precedence. Note that you must rebuild your system if 183 - you add files to any of these directories. For quick testing, 180 + firmware to function). If multiple packages contain firmware 181 + files with the same name, the first package in the list takes 182 + precedence. Note that you must rebuild your system if you add 183 + files to any of these directories. For quick testing, 184 184 put firmware files in <filename>/root/test-firmware</filename> 185 - and add that directory to the list. Note that you can also 186 - add firmware packages to this list as these are directories in 187 - the nix store. 185 + and add that directory to the list. 188 186 ''; 189 187 apply = list: pkgs.buildEnv { 190 188 name = "firmware"; 191 189 paths = list; 192 - pathsToLink = [ "/" ]; 190 + pathsToLink = [ "/lib/firmware" ]; 193 191 ignoreCollisions = true; 194 192 }; 195 193 }; ··· 236 234 (isYes "NET") 237 235 ]; 238 236 239 - boot.extraModprobeConfig = "options firmware_class path=${config.hardware.firmware}"; 237 + boot.extraModprobeConfig = "options firmware_class path=${config.hardware.firmware}/lib/firmware"; 240 238 241 239 system.activationScripts.udevd = 242 240 '' ··· 254 252 255 253 # Allow the kernel to find our firmware. 256 254 if [ -e /sys/module/firmware_class/parameters/path ]; then 257 - echo -n "${config.hardware.firmware}" > /sys/module/firmware_class/parameters/path 255 + echo -n "${config.hardware.firmware}/lib/firmware" > /sys/module/firmware_class/parameters/path 258 256 fi 259 257 ''; 260 258
+1 -1
nixos/modules/system/activation/top-level.nix
··· 50 50 51 51 ln -s ${config.system.build.initialRamdisk}/initrd $out/initrd 52 52 53 - ln -s ${config.hardware.firmware} $out/firmware 53 + ln -s ${config.hardware.firmware}/lib/firmware $out/firmware 54 54 ''} 55 55 56 56 echo "$activationScript" > $out/activate
+1 -1
nixos/modules/system/boot/kernel.nix
··· 216 216 ]; 217 217 218 218 # The Linux kernel >= 2.6.27 provides firmware. 219 - hardware.firmware = [ "${kernel}/lib/firmware" ]; 219 + hardware.firmware = [ kernel ]; 220 220 221 221 # Create /etc/modules-load.d/nixos.conf, which is read by 222 222 # systemd-modules-load.service to load required kernel modules.
+2 -2
pkgs/os-specific/linux/firmware/b43-firmware/5.1.138.nix
··· 15 15 phases = [ "unpackPhase" "installPhase" ]; 16 16 17 17 installPhase = '' 18 - mkdir $out 19 - b43-fwcutter -w $out linux/wl_apsta.o 18 + mkdir -p $out/lib/firmware 19 + b43-fwcutter -w $out/lib/firmware linux/wl_apsta.o 20 20 ''; 21 21 22 22 meta = {
+4 -4
pkgs/os-specific/linux/firmware/zd1211/default.nix
··· 5 5 version = "1.5"; 6 6 7 7 name = "${pname}-${version}"; 8 - 8 + 9 9 src = fetchurl { 10 10 url = "mirror://sourceforge/zd1211/${name}.tar.bz2"; 11 11 sha256 = "04ibs0qw8bh6h6zmm5iz6lddgknwhsjq8ib3gyck6a7psw83h7gi"; 12 12 }; 13 - 13 + 14 14 buildPhase = "true"; 15 15 16 - installPhase = "mkdir -p $out/zd1211; cp * $out/zd1211"; 17 - 16 + installPhase = "mkdir -p $out/lib/firmware/zd1211; cp * $out/lib/firmware/zd1211"; 17 + 18 18 meta = { 19 19 description = "Firmware for the ZyDAS ZD1211(b) 802.11a/b/g USB WLAN chip"; 20 20 homepage = http://sourceforge.net/projects/zd1211/;
+1 -1
pkgs/os-specific/linux/wis-go7007/default.nix
··· 56 56 mkdir -p $out/etc/udev/rules.d 57 57 58 58 makeFlagsArray=(KERNELSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/source \ 59 - FIRMWARE_DIR=$out/firmware FXLOAD=${fxload}/sbin/fxload \ 59 + FIRMWARE_DIR=$out/lib/firmware FXLOAD=${fxload}/sbin/fxload \ 60 60 DESTDIR=$out SKIP_DEPMOD=1 \ 61 61 USE_UDEV=y) 62 62 ''; # */