forked from mirrors/nixpkgs
nixos opengl: add s2tc to mesa drivers by default
Close #2200. Thanks to @cpages for suggesting and testing this.
This commit is contained in:
parent
73b4b287bb
commit
557dff54aa
|
@ -39,8 +39,7 @@ in {
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
Make S3TC(S3 Texture Compression) via libtxc_dxtn available
|
Make S3TC(S3 Texture Compression) via libtxc_dxtn available
|
||||||
to OpenGL drivers. It is essential for many games to work
|
to OpenGL drivers instead of the patent-free S2TC replacement.
|
||||||
with FOSS GPU drivers.
|
|
||||||
|
|
||||||
Using this library may require a patent license depending on your location.
|
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
|
else if elem "ati_unfree" cfg.videoDrivers then
|
||||||
"ln -sf ${kernelPackages.ati_drivers_x11} /run/opengl-driver"
|
"ln -sf ${kernelPackages.ati_drivers_x11} /run/opengl-driver"
|
||||||
else
|
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
|
${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 =
|
environment.variables.LD_LIBRARY_PATH =
|
||||||
[ "/run/opengl-driver/lib" "/run/opengl-driver-32/lib" ]
|
[ "/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";
|
|
||||||
|
|
||||||
boot.extraModulePackages =
|
boot.extraModulePackages =
|
||||||
optional (elem "nvidia" cfg.videoDrivers) kernelPackages.nvidia_x11 ++
|
optional (elem "nvidia" cfg.videoDrivers) kernelPackages.nvidia_x11 ++
|
||||||
|
|
Loading…
Reference in a new issue