diff options
-rw-r--r-- | modules/hardware/network/intel-2200bg.nix | 35 | ||||
-rw-r--r-- | modules/hardware/network/intel-3945abg.nix | 35 | ||||
-rw-r--r-- | modules/installer/tools/nixos-hardware-scan.pl | 13 | ||||
-rw-r--r-- | modules/module-list.mask | 4 | ||||
-rw-r--r-- | modules/module-list.nix | 2 |
5 files changed, 58 insertions, 31 deletions
diff --git a/modules/hardware/network/intel-2200bg.nix b/modules/hardware/network/intel-2200bg.nix index a9069da1e94..382f7b78bd9 100644 --- a/modules/hardware/network/intel-2200bg.nix +++ b/modules/hardware/network/intel-2200bg.nix @@ -1,11 +1,34 @@ {pkgs, config, ...}: { - services = { - udev = { - # Warning: setting this option requires acceptance of the firmware - # license, see http://ipw2200.sourceforge.net/firmware.php?fid=7. - addFirmware = [ pkgs.ipw2200fw ]; + + ###### interface + + options = { + + networking.enableIntel2200BGFirmware = pkgs.lib.mkOption { + default = false; + type = pkgs.lib.types.bool; + description = '' + Turn on this option if you want firmware for the Intel + PRO/Wireless 2200BG to be loaded automatically. This is + required if you want to use this device. Intel requires you to + accept the license for this firmware, see + <link xlink:href='http://ipw2200.sourceforge.net/firmware.php?fid=7'/>. + ''; }; + + }; + + + ###### implementation + + config = pkgs.lib.mkIf config.networking.enableIntel2200BGFirmware { + + # Warning: setting this option requires acceptance of the firmware + # license, see http://ipw2200.sourceforge.net/firmware.php?fid=7. + services.udev.addFirmware = [ pkgs.ipw2200fw ]; + }; -} \ No newline at end of file + +} diff --git a/modules/hardware/network/intel-3945abg.nix b/modules/hardware/network/intel-3945abg.nix index 3344704ba5a..5468f7bc18d 100644 --- a/modules/hardware/network/intel-3945abg.nix +++ b/modules/hardware/network/intel-3945abg.nix @@ -1,22 +1,29 @@ {pkgs, config, ...}: -let - inherit (config.boot) kernelPackages; -in +{ -# !!! make this optional + ###### interface + + options = { + + networking.enableIntel3945ABGFirmware = pkgs.lib.mkOption { + default = false; + type = pkgs.lib.types.bool; + description = '' + This option enables automatic loading of the firmware for the Intel + PRO/Wireless 3945ABG. + ''; + }; -{ - boot = { - extraModulePackages = - pkgs.lib.optional - (!kernelPackages.kernel.features ? iwlwifi) - kernelPackages.iwlwifi; }; - services = { - udev = { - addFirmware = [ pkgs.iwlwifi3945ucode ]; - }; + + ###### implementation + + config = pkgs.lib.mkIf config.networking.enableIntel3945ABGFirmware { + + services.udev.addFirmware = [ pkgs.iwlwifi3945ucode ]; + }; + } diff --git a/modules/installer/tools/nixos-hardware-scan.pl b/modules/installer/tools/nixos-hardware-scan.pl index c1d94b93927..73f65a6d83e 100644 --- a/modules/installer/tools/nixos-hardware-scan.pl +++ b/modules/installer/tools/nixos-hardware-scan.pl @@ -4,7 +4,7 @@ use File::Spec; use File::Basename; -my @requireList = (); +my @attrs = (); my @kernelModules = (); my @initrdKernelModules = (); @@ -96,12 +96,12 @@ sub pciCheck { # Can't rely on $module here, since the module may not be loaded # due to missing firmware. Ideally we would check modules.pcimap # here. - push @requireList, "./nixos/hardware/network/intel-2200bg.nix" if + push @attrs, "networking.enableIntel2200BGFirmware = true;" if $vendor eq "0x8086" && ($device eq "0x1043" || $device eq "0x104f" || $device eq "0x4220" || $device eq "0x4221" || $device eq "0x4223" || $device eq "0x4224"); - push @requireList, "./nixos/hardware/network/intel-3945abg.nix" if + push @attrs, "networking.enableIntel3945ABGFirmware = true;" if $vendor eq "0x8086" && ($device eq "0x4229" || $device eq "0x4230" || $device eq "0x4222" || $device eq "0x4227"); @@ -202,7 +202,7 @@ sub multiLineList { my $indent = shift; my $res = ""; foreach my $s (@_) { - $res .= "\n$indent $s"; + $res .= "\n$indent$s"; } $res .= "\n$indent"; return $res; @@ -210,19 +210,18 @@ sub multiLineList { my $initrdKernelModules = toNixExpr(removeDups @initrdKernelModules); my $kernelModules = toNixExpr(removeDups @kernelModules); -my $requireList = multiLineList(" ", removeDups @requireList); +my $attrs = multiLineList(" ", removeDups @attrs); print <<EOF ; # This is a generated file. Do not modify! # Make changes to /etc/nixos/configuration.nix instead. { - require = [$requireList]; - boot.initrd.extraKernelModules = [ $initrdKernelModules ]; boot.kernelModules = [ $kernelModules ]; nix.maxJobs = $cpus; services.xserver.videoDriver = "$videoDriver"; + $attrs } EOF diff --git a/modules/module-list.mask b/modules/module-list.mask deleted file mode 100644 index 10e9f58925e..00000000000 --- a/modules/module-list.mask +++ /dev/null @@ -1,4 +0,0 @@ -# CD-DVD modules are not generic. -# Avoid all modules from ./installer/cd-dvd/ - -./installer/cd-dvd/* diff --git a/modules/module-list.nix b/modules/module-list.nix index cd37d967066..9938cc6e1b5 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -8,6 +8,8 @@ ./config/timezone.nix ./config/unix-odbc-drivers.nix ./config/users-groups.nix + ./hardware/network/intel-2200bg.nix + ./hardware/network/intel-3945abg.nix ./hardware/pcmcia.nix ./installer/grub/grub.nix ./installer/tools/nixos-checkout.nix |