From 0898fee0deacb95bce457f042eeeb9cfdd082ff6 Mon Sep 17 00:00:00 2001 From: Sandro Jäckel Date: Thu, 6 Jun 2024 00:35:29 +0200 Subject: nixos/opengl: remove with lib over entire file --- nixos/modules/hardware/opengl.nix | 54 +++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 28 deletions(-) (limited to 'nixos') diff --git a/nixos/modules/hardware/opengl.nix b/nixos/modules/hardware/opengl.nix index 25324fd8b0af9..ac115021265fa 100644 --- a/nixos/modules/hardware/opengl.nix +++ b/nixos/modules/hardware/opengl.nix @@ -1,7 +1,5 @@ { config, lib, pkgs, ... }: -with lib; - let cfg = config.hardware.opengl; @@ -25,14 +23,14 @@ in { imports = [ - (mkRenamedOptionModule [ "services" "xserver" "vaapiDrivers" ] [ "hardware" "opengl" "extraPackages" ]) - (mkRemovedOptionModule [ "hardware" "opengl" "s3tcSupport" ] "S3TC support is now always enabled in Mesa.") + (lib.mkRenamedOptionModule [ "services" "xserver" "vaapiDrivers" ] [ "hardware" "opengl" "extraPackages" ]) + (lib.mkRemovedOptionModule [ "hardware" "opengl" "s3tcSupport" ] "S3TC support is now always enabled in Mesa.") ]; options = { hardware.opengl = { - enable = mkOption { + enable = lib.mkOption { description = '' Whether to enable OpenGL drivers. This is needed to enable OpenGL support in X11 systems, as well as for Wayland compositors @@ -42,12 +40,12 @@ in compositor of choice. See services.xserver.enable and programs.sway.enable. ''; - type = types.bool; + type = lib.types.bool; default = false; }; - driSupport = mkOption { - type = types.bool; + driSupport = lib.mkOption { + type = lib.types.bool; default = true; description = '' Whether to enable accelerated OpenGL rendering through the @@ -55,8 +53,8 @@ in ''; }; - driSupport32Bit = mkOption { - type = types.bool; + driSupport32Bit = lib.mkOption { + type = lib.types.bool; default = false; description = '' On 64-bit systems, whether to support Direct Rendering for @@ -66,16 +64,16 @@ in ''; }; - package = mkOption { - type = types.package; + package = lib.mkOption { + type = lib.types.package; internal = true; description = '' The package that provides the OpenGL implementation. ''; }; - package32 = mkOption { - type = types.package; + package32 = lib.mkOption { + type = lib.types.package; internal = true; description = '' The package that provides the 32-bit OpenGL implementation on @@ -84,10 +82,10 @@ in ''; }; - extraPackages = mkOption { - type = types.listOf types.package; + extraPackages = lib.mkOption { + type = lib.types.listOf lib.types.package; 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 = '' Additional packages to add to OpenGL drivers. This can be used to add OpenCL drivers, VA-API/VDPAU drivers etc. @@ -98,10 +96,10 @@ in ''; }; - extraPackages32 = mkOption { - type = types.listOf types.package; + extraPackages32 =lib. mkOption { + type = lib.types.listOf lib.types.package; 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 = '' 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. @@ -112,8 +110,8 @@ in ''; }; - setLdLibraryPath = mkOption { - type = types.bool; + setLdLibraryPath = lib.mkOption { + type = lib.types.bool; internal = true; default = false; description = '' @@ -128,7 +126,7 @@ in }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { assertions = [ { assertion = cfg.driSupport32Bit -> pkgs.stdenv.isx86_64; message = "Option driSupport32Bit only makes sense on a 64-bit system."; @@ -150,12 +148,12 @@ in ) ]; - environment.sessionVariables.LD_LIBRARY_PATH = mkIf cfg.setLdLibraryPath - ([ "/run/opengl-driver/lib" ] ++ optional cfg.driSupport32Bit "/run/opengl-driver-32/lib"); + environment.sessionVariables.LD_LIBRARY_PATH = lib.mkIf cfg.setLdLibraryPath + ([ "/run/opengl-driver/lib" ] ++ lib.optional cfg.driSupport32Bit "/run/opengl-driver-32/lib"); - hardware.opengl.package = mkDefault pkgs.mesa.drivers; - hardware.opengl.package32 = mkDefault pkgs.pkgsi686Linux.mesa.drivers; + hardware.opengl.package = lib.mkDefault pkgs.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; }; } -- cgit 1.4.1