1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-25 07:00:43 +00:00

Rename hardware.opengl.videoDrivers back to services.xserver.videoDrivers

Fixes #2379.
The new name was a misnomer because the values really are X11 video
drivers (e.g. ‘cirrus’ or ‘nvidia’), not OpenGL implementations. That
it's also used to set an OpenGL implementation for kmscon is just
confusing overloading.
This commit is contained in:
Eelco Dolstra 2014-04-29 12:58:54 +02:00
parent e6b5c0121f
commit 3fe96bcca1
10 changed files with 49 additions and 40 deletions

View file

@ -1195,7 +1195,7 @@ driver from a set of X.org drivers (such as <literal>vesa</literal>
and <literal>intel</literal>). You can also specify a driver
manually, e.g.
<programlisting>
hardware.opengl.videoDrivers = [ "r128" ];
services.xserver.videoDrivers = [ "r128" ];
</programlisting>
to enable X.orgs <literal>xf86-video-r128</literal> driver.</para>
@ -1238,7 +1238,7 @@ $ systemctl start display-manager.service
has better 3D performance than the X.org drivers. It is not enabled
by default because its not free software. You can enable it as follows:
<programlisting>
hardware.opengl.videoDrivers = [ "nvidia" ];
services.xserver.videoDrivers = [ "nvidia" ];
</programlisting>
You may need to reboot after enabling this driver to prevent a clash
with other kernel modules.</para>

View file

@ -1,14 +1,21 @@
{ config, pkgs, pkgs_i686, ... }:
{ config, lib, pkgs, pkgs_i686, ... }:
with lib;
let
inherit (pkgs.lib) mkOption types mkIf optional optionals elem optionalString optionalAttrs;
cfg = config.hardware.opengl;
kernelPackages = config.boot.kernelPackages;
in {
videoDrivers = config.services.xserver.videoDrivers;
in
{
options = {
hardware.opengl.enable = mkOption {
description = "Whether this configuration requires opengl.";
description = "Whether this configuration requires OpenGL.";
type = types.bool;
default = false;
internal = true;
@ -45,18 +52,6 @@ in {
'';
};
hardware.opengl.videoDrivers = mkOption {
type = types.listOf types.str;
# !!! We'd like "nv" here, but it segfaults the X server.
default = [ "ati" "cirrus" "intel" "vesa" "vmware" ];
example = [ "vesa" ];
description = ''
The names of the opengl video drivers the configuration
supports. They will be tried in order until one that
supports your card is found.
'';
};
};
config = mkIf cfg.enable {
@ -71,21 +66,21 @@ in {
${optionalString (pkgs.stdenv.isi686) "ln -sf opengl-driver /run/opengl-driver-32"}
''
#TODO: The OpenGL driver should depend on what's detected at runtime.
+( if elem "nvidia" cfg.videoDrivers then
+( if elem "nvidia" videoDrivers then
''
ln -sf ${kernelPackages.nvidia_x11} /run/opengl-driver
${optionalString cfg.driSupport32Bit
"ln -sf ${pkgs_i686.linuxPackages.nvidia_x11.override { libsOnly = true; kernel = null; } } /run/opengl-driver-32"}
''
else if elem "nvidiaLegacy173" cfg.videoDrivers then
else if elem "nvidiaLegacy173" videoDrivers then
"ln -sf ${kernelPackages.nvidia_x11_legacy173} /run/opengl-driver"
else if elem "nvidiaLegacy304" cfg.videoDrivers then
else if elem "nvidiaLegacy304" videoDrivers then
''
ln -sf ${kernelPackages.nvidia_x11_legacy304} /run/opengl-driver
${optionalString cfg.driSupport32Bit
"ln -sf ${pkgs_i686.linuxPackages.nvidia_x11_legacy304.override { libsOnly = true; kernel = null; } } /run/opengl-driver-32"}
''
else if elem "ati_unfree" cfg.videoDrivers then
else if elem "ati_unfree" videoDrivers then
"ln -sf ${kernelPackages.ati_drivers_x11} /run/opengl-driver"
else
let
@ -109,19 +104,20 @@ in {
[ "/run/opengl-driver/lib" "/run/opengl-driver-32/lib" ];
boot.extraModulePackages =
optional (elem "nvidia" cfg.videoDrivers) kernelPackages.nvidia_x11 ++
optional (elem "nvidiaLegacy173" cfg.videoDrivers) kernelPackages.nvidia_x11_legacy173 ++
optional (elem "nvidiaLegacy304" cfg.videoDrivers) kernelPackages.nvidia_x11_legacy304 ++
optional (elem "virtualbox" cfg.videoDrivers) kernelPackages.virtualboxGuestAdditions ++
optional (elem "ati_unfree" cfg.videoDrivers) kernelPackages.ati_drivers_x11;
optional (elem "nvidia" videoDrivers) kernelPackages.nvidia_x11 ++
optional (elem "nvidiaLegacy173" videoDrivers) kernelPackages.nvidia_x11_legacy173 ++
optional (elem "nvidiaLegacy304" videoDrivers) kernelPackages.nvidia_x11_legacy304 ++
optional (elem "virtualbox" videoDrivers) kernelPackages.virtualboxGuestAdditions ++
optional (elem "ati_unfree" videoDrivers) kernelPackages.ati_drivers_x11;
boot.blacklistedKernelModules =
optionals (elem "nvidia" cfg.videoDrivers) [ "nouveau" "nvidiafb" ];
optionals (elem "nvidia" videoDrivers) [ "nouveau" "nvidiafb" ];
environment.etc = (optionalAttrs (elem "ati_unfree" cfg.videoDrivers) {
environment.etc =
(optionalAttrs (elem "ati_unfree" videoDrivers) {
"ati".source = "${kernelPackages.ati_drivers_x11}/etc/ati";
})
// (optionalAttrs (elem "nvidia" cfg.videoDrivers) {
// (optionalAttrs (elem "nvidia" videoDrivers) {
"OpenCL/vendors/nvidia.icd".source = "${kernelPackages.nvidia_x11}/lib/vendors/nvidia.icd";
});
};

View file

@ -138,7 +138,8 @@ in
};
# Setting vesa, we don't get the nvidia driver, which can't work in arm.
hardware.opengl.videoDrivers = [ "vesa" ];
services.xserver.videoDrivers = [ "vesa" ];
services.nixosManual.enable = false;
# Include the firmware for various wireless cards.

View file

@ -165,7 +165,7 @@ foreach my $path (glob "/sys/bus/pci/devices/*") {
pciCheck $path;
}
push @attrs, "hardware.opengl.videoDrivers = [ \"$videoDriver\" ];" if $videoDriver;
push @attrs, "services.xserver.videoDrivers = [ \"$videoDriver\" ];" if $videoDriver;
# Idem for USB devices.

View file

@ -15,5 +15,5 @@ with lib;
# Add some more video drivers to give X11 a shot at working in
# VMware and QEMU.
hardware.opengl.videoDrivers = mkOverride 40 [ "virtualbox" "vmware" "cirrus" "vesa" ];
services.xserver.videoDrivers = mkOverride 40 [ "virtualbox" "vmware" "cirrus" "vesa" ];
}

View file

@ -121,7 +121,7 @@ in zipModules ([]
++ obsolete [ "services" "xserver" "driSupport" ] [ "hardware" "opengl" "driSupport" ]
++ obsolete [ "services" "xserver" "driSupport32Bit" ] [ "hardware" "opengl" "driSupport32Bit" ]
++ obsolete [ "services" "xserver" "s3tcSupport" ] [ "hardware" "opengl" "s3tcSupport" ]
++ obsolete [ "services" "xserver" "videoDrivers" ] [ "hardware" "opengl" "videoDrivers" ]
++ obsolete [ "hardware" "opengl" "videoDrivers" ] [ "services" "xserver" "videoDrivers" ]
++ obsolete [ "services" "mysql55" ] [ "services" "mysql" ]

View file

@ -27,7 +27,7 @@ in
config = {
services.xserver.enable = true;
hardware.opengl.videoDrivers = [];
services.xserver.videoDrivers = [];
# Enable KDM. Any display manager will do as long as it supports XDMCP.
services.xserver.displayManager.kdm.enable = true;

View file

@ -24,7 +24,7 @@ let
intel-testing = { modules = with pkgs.xorg; [ xf86videointel-testing glamoregl ]; driverName = "intel"; };
};
driverNames = config.hardware.opengl.videoDrivers;
driverNames = cfg.videoDrivers;
needsAcpid =
(elem "nvidia" driverNames) ||
@ -181,6 +181,18 @@ in
'';
};
videoDrivers = mkOption {
type = types.listOf types.str;
# !!! We'd like "nv" here, but it segfaults the X server.
default = [ "ati" "cirrus" "intel" "vesa" "vmware" ];
example = [ "vesa" ];
description = ''
The names of the video drivers the configuration
supports. They will be tried in order until one that
supports your card is found.
'';
};
videoDriver = mkOption {
type = types.nullOr types.str;
default = null;
@ -188,7 +200,7 @@ in
description = ''
The name of the video driver for your graphics card. This
option is obsolete; please set the
<option>hardware.opengl.videoDrivers</option> instead.
<option>services.xserver.videoDrivers</option> instead.
'';
};
@ -386,7 +398,7 @@ in
config = mkIf cfg.enable {
hardware.opengl.enable = true;
hardware.opengl.videoDrivers = mkIf (cfg.videoDriver != null) [ cfg.videoDriver ];
services.xserver.videoDrivers = mkIf (cfg.videoDriver != null) [ cfg.videoDriver ];
assertions =
[ { assertion = !(config.programs.ssh.startAgent && cfg.startGnuPGAgent);

View file

@ -386,7 +386,7 @@ in
# When building a regular system configuration, override whatever
# video driver the host uses.
hardware.opengl.videoDrivers = mkVMOverride [ "vesa" ];
services.xserver.videoDrivers = mkVMOverride [ "vesa" ];
services.xserver.defaultDepth = mkVMOverride 0;
services.xserver.resolutions = mkVMOverride [ { x = 1024; y = 768; } ];
services.xserver.monitorSection =

View file

@ -54,7 +54,7 @@ optionalAttrs (pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64) # ugly...
serviceConfig.ExecStart = "@${kernel.virtualboxGuestAdditions}/sbin/VBoxService VBoxService --foreground";
};
hardware.opengl.videoDrivers = mkOverride 50 [ "virtualbox" ];
services.xserver.videoDrivers = mkOverride 50 [ "virtualbox" ];
services.xserver.config =
''