Browse Source

* Move the firmware loader into a separate module.

* services.udev.addFirmware -> hardware.firmware.

svn path=/nixos/trunk/; revision=16657
nsd-state-dir
Eelco Dolstra 14 years ago
parent
commit
167ccdd537
  1. 2
      modules/hardware/network/intel-2200bg.nix
  2. 2
      modules/hardware/network/intel-3945abg.nix
  3. 18
      modules/hardware/network/intel-4965agn.nix
  4. 6
      modules/hardware/network/intel-5000.nix
  5. 6
      modules/hardware/network/zydas-zd1211.nix
  6. 14
      modules/hardware/video/encoder/wis-go7007.nix
  7. 1
      modules/module-list.nix
  8. 51
      modules/services/hardware/firmware.nix
  9. 23
      modules/services/hardware/udev.nix
  10. 19
      modules/system/boot/kernel.nix

2
modules/hardware/network/intel-2200bg.nix

@ -27,7 +27,7 @@
# Warning: setting this option requires acceptance of the firmware
# license, see http://ipw2200.sourceforge.net/firmware.php?fid=7.
services.udev.addFirmware = [ pkgs.ipw2200fw ];
hardware.firmware = [ pkgs.ipw2200fw ];
};

2
modules/hardware/network/intel-3945abg.nix

@ -22,7 +22,7 @@
config = pkgs.lib.mkIf config.networking.enableIntel3945ABGFirmware {
services.udev.addFirmware = [ pkgs.iwlwifi3945ucode ];
hardware.firmware = [ pkgs.iwlwifi3945ucode ];
};

18
modules/hardware/network/intel-4965agn.nix

@ -1,21 +1,5 @@
{pkgs, config, ...}:
let
inherit (config.boot) kernelPackages;
inherit (kernelPackages) kernel;
in
{
boot = {
extraModulePackages =
pkgs.lib.optional
(!kernel.features ? iwlwifi)
kernelPackages.iwlwifi;
};
services = {
udev = {
addFirmware = [ kernelPackages.iwlwifi4965ucode ];
};
};
hardware.firmware = [ config.boot.kernelPackages.iwlwifi4965ucode ];
}

6
modules/hardware/network/intel-5000.nix

@ -1,9 +1,5 @@
{pkgs, config, ...}:
{
services = {
udev = {
addFirmware = [ pkgs.iwlwifi5000ucode ];
};
};
hardware.firmware = [ pkgs.iwlwifi5000ucode ];
}

6
modules/hardware/network/zydas-zd1211.nix

@ -1,9 +1,5 @@
{pkgs, config, ...}:
{
services = {
udev = {
addFirmware = [ pkgs.zd1211fw ];
};
};
hardware.firmware = [ pkgs.zd1211fw ];
}

14
modules/hardware/video/encoder/wis-go7007.nix

@ -1,17 +1,15 @@
{pkgs, config, ...}:
let
wisGo7007 = config.boot.kernelPackages.wis_go7007;
wisGo7007Pkg = [ wis_go7007 ];
wisGo7007Firmware = [ "${wis_go7007}/firmware" ];
wis_go7007 = config.boot.kernelPackages.wis_go7007;
in
{
boot.extraModulePackages = [wisGo7007Pkg];
boot.extraModulePackages = [wis_go7007];
environment.extraPackages = [wisGo7007Pkg];
environment.systemPackages = [wis_go7007];
services.udev.addFirmware = [wisGo7007Firmware];
services.udev.packages = [wisGo7007Pkg];
hardware.firmware = ["${wis_go7007}/firmware"];
services.udev.packages = [wis_go7007];
}

1
modules/module-list.nix

@ -31,6 +31,7 @@
./services/databases/mysql.nix
./services/databases/postgresql.nix
./services/hardware/acpid.nix
./services/hardware/firmware.nix
./services/hardware/hal.nix
./services/hardware/udev.nix
./services/logging/klogd.nix

51
modules/services/hardware/firmware.nix

@ -0,0 +1,51 @@
# This module provides support for automatic loading of firmware from
# kernel modules.
{pkgs, config, ...}:
with pkgs.lib;
let
firmwareLoader = pkgs.substituteAll {
src = ./udev-firmware-loader.sh;
path = "${pkgs.coreutils}/bin";
isExecutable = true;
firmwareDirs = config.hardware.firmware;
};
in
{
###### interface
options = {
hardware.firmware = mkOption {
default = [];
example = ["/root/my-firmware"];
merge = mergeListOption;
description = ''
List of directories containing firmware files. Such files
will be loaded automatically if the kernel asks for them
(i.e., when it has detected specific hardware that requires
firmware to function).
'';
};
};
###### implementation
config = {
services.udev.extraRules =
''
# Firmware loading.
SUBSYSTEM=="firmware", ACTION=="add", RUN+="${firmwareLoader}"
'';
};
}

23
modules/services/hardware/udev.nix

@ -4,17 +4,10 @@ with pkgs.lib;
let
inherit (pkgs) substituteAll stdenv writeText udev procps;
inherit (pkgs) stdenv writeText udev procps;
cfg = config.services.udev;
firmwareLoader = substituteAll {
src = ./udev-firmware-loader.sh;
path = "${stdenv.coreutils}/bin";
isExecutable = true;
firmwareDirs = cfg.addFirmware;
};
extraUdevRules = pkgs.writeTextFile {
name = "extra-udev-rules";
text = cfg.extraRules;
@ -45,9 +38,6 @@ let
KERNEL=="timer", NAME="snd/%k", MODE="${cfg.sndMode}"
KERNEL=="seq", NAME="snd/%k", MODE="${cfg.sndMode}"
# Firmware loading.
SUBSYSTEM=="firmware", ACTION=="add", RUN+="${firmwareLoader}"
'';
# Perform substitutions in all udev rules files.
@ -121,17 +111,6 @@ in
services.udev = {
addFirmware = mkOption {
default = [];
example = ["/mnt/big-storage/firmware/"];
merge = mergeListOption;
description = ''
To specify firmware that is not too spread to ensure
a package, or have an interactive process of extraction
and cannot be redistributed.
'';
};
packages = mkOption {
default = [];
merge = mergeListOption;

19
modules/system/boot/kernel.nix

@ -179,21 +179,10 @@ let
in
{
require = [
options
require = [options];
# udev
];
system.modulesTree = [ kernel ] ++ config.boot.extraModulePackages;
system = {
# include kernel modules.
modulesTree = [ kernel ] ++ config.boot.extraModulePackages;
};
services = {
udev = {
# The Linux kernel >= 2.6.27 provides firmware
addFirmware = [ "${kernel}/lib/firmware" ];
};
};
# The Linux kernel >= 2.6.27 provides firmware.
hardware.firmware = [ "${kernel}/lib/firmware" ];
}
Loading…
Cancel
Save