* Move the firmware loader into a separate module.
* services.udev.addFirmware -> hardware.firmware. svn path=/nixos/trunk/; revision=16657
This commit is contained in:
parent
b3c0061a91
commit
167ccdd537
10 changed files with 68 additions and 74 deletions
|
@ -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 ];
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
config = pkgs.lib.mkIf config.networking.enableIntel3945ABGFirmware {
|
||||
|
||||
services.udev.addFirmware = [ pkgs.iwlwifi3945ucode ];
|
||||
hardware.firmware = [ pkgs.iwlwifi3945ucode ];
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -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 ];
|
||||
}
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
{pkgs, config, ...}:
|
||||
|
||||
{
|
||||
services = {
|
||||
udev = {
|
||||
addFirmware = [ pkgs.iwlwifi5000ucode ];
|
||||
};
|
||||
};
|
||||
hardware.firmware = [ pkgs.iwlwifi5000ucode ];
|
||||
}
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
{pkgs, config, ...}:
|
||||
|
||||
{
|
||||
services = {
|
||||
udev = {
|
||||
addFirmware = [ pkgs.zd1211fw ];
|
||||
};
|
||||
};
|
||||
hardware.firmware = [ pkgs.zd1211fw ];
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -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
Normal file
51
modules/services/hardware/firmware.nix
Normal file
|
@ -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}"
|
||||
'';
|
||||
|
||||
};
|
||||
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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…
Reference in a new issue