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:
parent
77986803a6
commit
a3a467ce77
@ -11,20 +11,21 @@ let
|
||||
# FIXME: should introduce an option like
|
||||
# ‘hardware.video.nvidia.package’ for overriding the default NVIDIA
|
||||
# driver.
|
||||
enabled = elem "nvidia" drivers || elem "nvidiaLegacy173" drivers
|
||||
|| elem "nvidiaLegacy304" drivers || elem "nvidiaLegacy340" drivers;
|
||||
|
||||
nvidia_x11 =
|
||||
nvidiaForKernel = kernelPackages:
|
||||
if elem "nvidia" drivers then
|
||||
config.boot.kernelPackages.nvidia_x11
|
||||
kernelPackages.nvidia_x11
|
||||
else if elem "nvidiaLegacy173" drivers then
|
||||
config.boot.kernelPackages.nvidia_x11_legacy173
|
||||
kernelPackages.nvidia_x11_legacy173
|
||||
else if elem "nvidiaLegacy304" drivers then
|
||||
config.boot.kernelPackages.nvidia_x11_legacy304
|
||||
kernelPackages.nvidia_x11_legacy304
|
||||
else if elem "nvidiaLegacy340" drivers then
|
||||
config.boot.kernelPackages.nvidia_x11_legacy340
|
||||
else throw "impossible";
|
||||
kernelPackages.nvidia_x11_legacy340
|
||||
else null;
|
||||
|
||||
nvidia_x11 = nvidiaForKernel config.boot.kernelPackages;
|
||||
nvidia_libs32 = (nvidiaForKernel pkgs_i686.linuxPackages).override { libsOnly = true; kernel = null; };
|
||||
|
||||
enabled = nvidia_x11 != null;
|
||||
in
|
||||
|
||||
{
|
||||
@ -40,7 +41,7 @@ in
|
||||
'';
|
||||
|
||||
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 ];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user