nixos/opengl: remove with lib over entire file
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.hardware.opengl;
|
cfg = config.hardware.opengl;
|
||||||
@@ -25,14 +23,14 @@ in
|
|||||||
{
|
{
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
(mkRenamedOptionModule [ "services" "xserver" "vaapiDrivers" ] [ "hardware" "opengl" "extraPackages" ])
|
(lib.mkRenamedOptionModule [ "services" "xserver" "vaapiDrivers" ] [ "hardware" "opengl" "extraPackages" ])
|
||||||
(mkRemovedOptionModule [ "hardware" "opengl" "s3tcSupport" ] "S3TC support is now always enabled in Mesa.")
|
(lib.mkRemovedOptionModule [ "hardware" "opengl" "s3tcSupport" ] "S3TC support is now always enabled in Mesa.")
|
||||||
];
|
];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
hardware.opengl = {
|
hardware.opengl = {
|
||||||
enable = mkOption {
|
enable = lib.mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
Whether to enable OpenGL drivers. This is needed to enable
|
Whether to enable OpenGL drivers. This is needed to enable
|
||||||
OpenGL support in X11 systems, as well as for Wayland compositors
|
OpenGL support in X11 systems, as well as for Wayland compositors
|
||||||
@@ -42,12 +40,12 @@ in
|
|||||||
compositor of choice. See services.xserver.enable and
|
compositor of choice. See services.xserver.enable and
|
||||||
programs.sway.enable.
|
programs.sway.enable.
|
||||||
'';
|
'';
|
||||||
type = types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
driSupport = mkOption {
|
driSupport = lib.mkOption {
|
||||||
type = types.bool;
|
type = lib.types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = ''
|
description = ''
|
||||||
Whether to enable accelerated OpenGL rendering through the
|
Whether to enable accelerated OpenGL rendering through the
|
||||||
@@ -55,8 +53,8 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
driSupport32Bit = mkOption {
|
driSupport32Bit = lib.mkOption {
|
||||||
type = types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
On 64-bit systems, whether to support Direct Rendering for
|
On 64-bit systems, whether to support Direct Rendering for
|
||||||
@@ -66,16 +64,16 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkOption {
|
package = lib.mkOption {
|
||||||
type = types.package;
|
type = lib.types.package;
|
||||||
internal = true;
|
internal = true;
|
||||||
description = ''
|
description = ''
|
||||||
The package that provides the OpenGL implementation.
|
The package that provides the OpenGL implementation.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package32 = mkOption {
|
package32 = lib.mkOption {
|
||||||
type = types.package;
|
type = lib.types.package;
|
||||||
internal = true;
|
internal = true;
|
||||||
description = ''
|
description = ''
|
||||||
The package that provides the 32-bit OpenGL implementation on
|
The package that provides the 32-bit OpenGL implementation on
|
||||||
@@ -84,10 +82,10 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
extraPackages = mkOption {
|
extraPackages = lib.mkOption {
|
||||||
type = types.listOf types.package;
|
type = lib.types.listOf lib.types.package;
|
||||||
default = [];
|
default = [];
|
||||||
example = literalExpression "with pkgs; [ intel-media-driver intel-ocl intel-vaapi-driver ]";
|
example = lib.literalExpression "with pkgs; [ intel-media-driver intel-ocl intel-vaapi-driver ]";
|
||||||
description = ''
|
description = ''
|
||||||
Additional packages to add to OpenGL drivers.
|
Additional packages to add to OpenGL drivers.
|
||||||
This can be used to add OpenCL drivers, VA-API/VDPAU drivers etc.
|
This can be used to add OpenCL drivers, VA-API/VDPAU drivers etc.
|
||||||
@@ -98,10 +96,10 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
extraPackages32 = mkOption {
|
extraPackages32 =lib. mkOption {
|
||||||
type = types.listOf types.package;
|
type = lib.types.listOf lib.types.package;
|
||||||
default = [];
|
default = [];
|
||||||
example = literalExpression "with pkgs.pkgsi686Linux; [ intel-media-driver intel-vaapi-driver ]";
|
example = lib.literalExpression "with pkgs.pkgsi686Linux; [ intel-media-driver intel-vaapi-driver ]";
|
||||||
description = ''
|
description = ''
|
||||||
Additional packages to add to 32-bit OpenGL drivers on 64-bit systems.
|
Additional packages to add to 32-bit OpenGL drivers on 64-bit systems.
|
||||||
Used when {option}`driSupport32Bit` is set. This can be used to add OpenCL drivers, VA-API/VDPAU drivers etc.
|
Used when {option}`driSupport32Bit` is set. This can be used to add OpenCL drivers, VA-API/VDPAU drivers etc.
|
||||||
@@ -112,8 +110,8 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
setLdLibraryPath = mkOption {
|
setLdLibraryPath = lib.mkOption {
|
||||||
type = types.bool;
|
type = lib.types.bool;
|
||||||
internal = true;
|
internal = true;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
@@ -128,7 +126,7 @@ in
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
assertions = [
|
assertions = [
|
||||||
{ assertion = cfg.driSupport32Bit -> pkgs.stdenv.isx86_64;
|
{ assertion = cfg.driSupport32Bit -> pkgs.stdenv.isx86_64;
|
||||||
message = "Option driSupport32Bit only makes sense on a 64-bit system.";
|
message = "Option driSupport32Bit only makes sense on a 64-bit system.";
|
||||||
@@ -150,12 +148,12 @@ in
|
|||||||
)
|
)
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.sessionVariables.LD_LIBRARY_PATH = mkIf cfg.setLdLibraryPath
|
environment.sessionVariables.LD_LIBRARY_PATH = lib.mkIf cfg.setLdLibraryPath
|
||||||
([ "/run/opengl-driver/lib" ] ++ optional cfg.driSupport32Bit "/run/opengl-driver-32/lib");
|
([ "/run/opengl-driver/lib" ] ++ lib.optional cfg.driSupport32Bit "/run/opengl-driver-32/lib");
|
||||||
|
|
||||||
hardware.opengl.package = mkDefault pkgs.mesa.drivers;
|
hardware.opengl.package = lib.mkDefault pkgs.mesa.drivers;
|
||||||
hardware.opengl.package32 = mkDefault pkgs.pkgsi686Linux.mesa.drivers;
|
hardware.opengl.package32 = lib.mkDefault pkgs.pkgsi686Linux.mesa.drivers;
|
||||||
|
|
||||||
boot.extraModulePackages = optional (elem "virtualbox" videoDrivers) kernelPackages.virtualboxGuestAdditions;
|
boot.extraModulePackages = lib.optional (lib.elem "virtualbox" videoDrivers) kernelPackages.virtualboxGuestAdditions;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user