diff --git a/modules/hardware/network/intel-2200bg.nix b/modules/hardware/network/intel-2200bg.nix index a9069da1e947..382f7b78bd93 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 + . + ''; }; + }; -} \ No newline at end of file + + + ###### 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 ]; + + }; + +} diff --git a/modules/hardware/network/intel-3945abg.nix b/modules/hardware/network/intel-3945abg.nix index 3344704ba5a6..5468f7bc18df 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 - { - boot = { - extraModulePackages = - pkgs.lib.optional - (!kernelPackages.kernel.features ? iwlwifi) - kernelPackages.iwlwifi; + + ###### 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. + ''; + }; + }; - 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 c1d94b939272..73f65a6d83ee 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 <