* nixos-hardware-scan: It's not necessary to detect Intel graphics

cards because the default X config contains the Intel driver.
  Likewise, there is no need for the "vesa" default.
* nixos-hardware-scan: Clean up the output a bit.

svn path=/nixos/trunk/; revision=26423
This commit is contained in:
Eelco Dolstra 2011-03-18 13:52:09 +00:00
parent ef07a945c4
commit 6c55079ab0

View File

@ -58,7 +58,7 @@ push @kernelModules, "kvm-amd" if hasCPUFeature "svm";
# modules are auto-detected so we don't need to list them here. # modules are auto-detected so we don't need to list them here.
# However, some are needed in the initrd to boot the system. # However, some are needed in the initrd to boot the system.
my $videoDriver = "vesa"; my $videoDriver;
sub pciCheck { sub pciCheck {
my $path = shift; my $path = shift;
@ -120,27 +120,6 @@ sub pciCheck {
($device eq "0x4229" || $device eq "0x4230" || ($device eq "0x4229" || $device eq "0x4230" ||
$device eq "0x4222" || $device eq "0x4227"); $device eq "0x4222" || $device eq "0x4227");
# Hm, can we extract the PCI ids supported by X drivers somehow?
# cf. http://www.calel.org/pci-devices/xorg-device-list.html
$videoDriver = "intel" if $vendor eq "0x8086" &&
($device eq "0x1132" ||
$device eq "0x2572" ||
$device eq "0x2592" ||
$device eq "0x2772" ||
$device eq "0x2776" ||
$device eq "0x2782" ||
$device eq "0x2792" ||
$device eq "0x2792" ||
$device eq "0x27a2" ||
$device eq "0x27a6" ||
$device eq "0x29a2" ||
$device eq "0x3582" ||
$device eq "0x7121" ||
$device eq "0x7123" ||
$device eq "0x7125" ||
$device eq "0x7128"
);
# Assume that all NVIDIA cards are supported by the NVIDIA driver. # Assume that all NVIDIA cards are supported by the NVIDIA driver.
# There may be exceptions (e.g. old cards). # There may be exceptions (e.g. old cards).
$videoDriver = "nvidia" if $vendor eq "0x10de" && $class =~ /^0x03/; $videoDriver = "nvidia" if $vendor eq "0x10de" && $class =~ /^0x03/;
@ -202,6 +181,11 @@ foreach my $path (glob "/sys/class/block/*") {
} }
if ($videoDriver) {
push @attrs, "services.xserver.videoDrivers = [ \"$videoDriver\" ];";
}
# Generate the configuration file. # Generate the configuration file.
sub removeDups { sub removeDups {
@ -227,10 +211,10 @@ sub toNixExpr {
sub multiLineList { sub multiLineList {
my $indent = shift; my $indent = shift;
my $res = ""; my $res = "";
$res = "\n" if scalar @_ > 0;
foreach my $s (@_) { foreach my $s (@_) {
$res .= "\n$indent$s"; $res .= "$indent$s\n";
} }
$res .= "\n$indent";
return $res; return $res;
} }
@ -255,8 +239,5 @@ print <<EOF ;
boot.extraModulePackages = [$modulePackages ]; boot.extraModulePackages = [$modulePackages ];
nix.maxJobs = $cpus; nix.maxJobs = $cpus;
$attrs}
services.xserver.videoDriver = "$videoDriver";
$attrs
}
EOF EOF