nixos opengl: add extraPackages and extraPackages32

This commit is contained in:
Nikolay Amiantov 2016-01-25 02:57:15 +03:00
parent 768f7d19b5
commit 1ae1791e8e

View file

@ -10,7 +10,7 @@ let
videoDrivers = config.services.xserver.videoDrivers;
makePackage = p: p.buildEnv {
makePackage = p: pkgs.buildEnv {
name = "mesa-drivers+txc-${p.mesa_drivers.version}";
paths =
[ p.mesa_drivers
@ -19,6 +19,16 @@ let
];
};
package = pkgs.buildEnv {
name = "opengl-drivers";
paths = [ cfg.package ] ++ cfg.extraPackages;
};
package32 = pkgs.buildEnv {
name = "opengl-drivers-32bit";
paths = [ cfg.package32 ] ++ cfg.extraPackages32;
};
in
{
@ -75,7 +85,25 @@ in
internal = true;
description = ''
The package that provides the 32-bit OpenGL implementation on
64-bit systems. Used when <option>driSupport32Bit</option> is
64-bit systems. Used when <option>driSupport32Bit</option> is
set.
'';
};
hardware.opengl.extraPackages = mkOption {
type = types.listOf types.package;
default = [];
description = ''
Additional packages to add to OpenGL drivers.
'';
};
hardware.opengl.extraPackages32 = mkOption {
type = types.listOf types.package;
default = [];
description = ''
Additional packages to add to 32-bit OpenGL drivers on
64-bit systems. Used when <option>driSupport32Bit</option> is
set.
'';
};
@ -91,11 +119,11 @@ in
system.activationScripts.setup-opengl =
''
ln -sfn ${cfg.package} /run/opengl-driver
ln -sfn ${package} /run/opengl-driver
${if pkgs.stdenv.isi686 then ''
ln -sfn opengl-driver /run/opengl-driver-32
'' else if cfg.driSupport32Bit then ''
ln -sfn ${cfg.package32} /run/opengl-driver-32
ln -sfn ${package32} /run/opengl-driver-32
'' else ''
rm -f /run/opengl-driver-32
''}