summary refs log tree commit diff
path: root/nixos/modules/hardware/opengl.nix
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2014-04-10 20:22:53 +0200
committerVladimír Čunát <vcunat@gmail.com>2014-04-14 21:38:23 +0200
commit557dff54aacdfd34f6f39d5e1d6c7354dba390f4 (patch)
treef1b11166b1c6533c8aa00ea7d323dfc63163564c /nixos/modules/hardware/opengl.nix
parent73b4b287bbf01177fdc29e8c858f47a5f2212907 (diff)
downloadnixlib-557dff54aacdfd34f6f39d5e1d6c7354dba390f4.tar
nixlib-557dff54aacdfd34f6f39d5e1d6c7354dba390f4.tar.gz
nixlib-557dff54aacdfd34f6f39d5e1d6c7354dba390f4.tar.bz2
nixlib-557dff54aacdfd34f6f39d5e1d6c7354dba390f4.tar.lz
nixlib-557dff54aacdfd34f6f39d5e1d6c7354dba390f4.tar.xz
nixlib-557dff54aacdfd34f6f39d5e1d6c7354dba390f4.tar.zst
nixlib-557dff54aacdfd34f6f39d5e1d6c7354dba390f4.zip
nixos opengl: add s2tc to mesa drivers by default
Close #2200. Thanks to @cpages for suggesting and testing this.
Diffstat (limited to 'nixos/modules/hardware/opengl.nix')
-rw-r--r--nixos/modules/hardware/opengl.nix20
1 files 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 ++