From 557dff54aacdfd34f6f39d5e1d6c7354dba390f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Thu, 10 Apr 2014 20:22:53 +0200 Subject: [PATCH] nixos opengl: add s2tc to mesa drivers by default Close #2200. Thanks to @cpages for suggesting and testing this. --- nixos/modules/hardware/opengl.nix | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/nixos/modules/hardware/opengl.nix b/nixos/modules/hardware/opengl.nix index 603012cb1092..06ecddab2362 100644 --- a/nixos/modules/hardware/opengl.nix +++ b/nixos/modules/hardware/opengl.nix @@ -39,8 +39,7 @@ in { default = false; description = '' Make S3TC(S3 Texture Compression) via libtxc_dxtn available - to OpenGL drivers. It is essential for many games to work - with FOSS GPU drivers. + to OpenGL drivers instead of the patent-free S2TC replacement. Using this library may require a patent license depending on your location. ''; @@ -89,17 +88,24 @@ in { else if elem "ati_unfree" cfg.videoDrivers then "ln -sf ${kernelPackages.ati_drivers_x11} /run/opengl-driver" else + let + lib_fun = p: p.buildEnv { + name = "mesa-drivers+txc-${p.mesa_drivers.version}"; + paths = [ + p.mesa_drivers + (if cfg.s3tcSupport then p.libtxc_dxtn else p.libtxc_dxtn_s2tc) + ]; + }; + in '' - ${optionalString cfg.driSupport "ln -sf ${pkgs.mesa_drivers} /run/opengl-driver"} + ${optionalString cfg.driSupport "ln -sf ${lib_fun pkgs} /run/opengl-driver"} ${optionalString cfg.driSupport32Bit - "ln -sf ${pkgs_i686.mesa_drivers} /run/opengl-driver-32"} + "ln -sf ${lib_fun pkgs_i686} /run/opengl-driver-32"} '' ); environment.variables.LD_LIBRARY_PATH = - [ "/run/opengl-driver/lib" "/run/opengl-driver-32/lib" ] - ++ optional cfg.s3tcSupport "${pkgs.libtxc_dxtn}/lib" - ++ optional (cfg.s3tcSupport && cfg.driSupport32Bit) "${pkgs_i686.libtxc_dxtn}/lib"; + [ "/run/opengl-driver/lib" "/run/opengl-driver-32/lib" ]; boot.extraModulePackages = optional (elem "nvidia" cfg.videoDrivers) kernelPackages.nvidia_x11 ++