nixos/nvidia: use correct 32-bit legacy libs; refactor

Fixes #6127.
Now we avoid multiple switches among the version possibilities.
This commit is contained in:
Vladimír Čunát 2015-02-21 16:29:36 +01:00
parent 77986803a6
commit a3a467ce77
1 changed files with 11 additions and 10 deletions

View File

@ -11,20 +11,21 @@ let
# FIXME: should introduce an option like # FIXME: should introduce an option like
# hardware.video.nvidia.package for overriding the default NVIDIA # hardware.video.nvidia.package for overriding the default NVIDIA
# driver. # driver.
enabled = elem "nvidia" drivers || elem "nvidiaLegacy173" drivers nvidiaForKernel = kernelPackages:
|| elem "nvidiaLegacy304" drivers || elem "nvidiaLegacy340" drivers;
nvidia_x11 =
if elem "nvidia" drivers then if elem "nvidia" drivers then
config.boot.kernelPackages.nvidia_x11 kernelPackages.nvidia_x11
else if elem "nvidiaLegacy173" drivers then else if elem "nvidiaLegacy173" drivers then
config.boot.kernelPackages.nvidia_x11_legacy173 kernelPackages.nvidia_x11_legacy173
else if elem "nvidiaLegacy304" drivers then else if elem "nvidiaLegacy304" drivers then
config.boot.kernelPackages.nvidia_x11_legacy304 kernelPackages.nvidia_x11_legacy304
else if elem "nvidiaLegacy340" drivers then else if elem "nvidiaLegacy340" drivers then
config.boot.kernelPackages.nvidia_x11_legacy340 kernelPackages.nvidia_x11_legacy340
else throw "impossible"; else null;
nvidia_x11 = nvidiaForKernel config.boot.kernelPackages;
nvidia_libs32 = (nvidiaForKernel pkgs_i686.linuxPackages).override { libsOnly = true; kernel = null; };
enabled = nvidia_x11 != null;
in in
{ {
@ -40,7 +41,7 @@ in
''; '';
hardware.opengl.package = nvidia_x11; hardware.opengl.package = nvidia_x11;
hardware.opengl.package32 = pkgs_i686.linuxPackages.nvidia_x11.override { libsOnly = true; kernel = null; }; hardware.opengl.package32 = nvidia_libs32;
environment.systemPackages = [ nvidia_x11 ]; environment.systemPackages = [ nvidia_x11 ];