about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@gmail.com>2024-06-06 00:35:29 +0200
committerSandro Jäckel <sandro.jaeckel@gmail.com>2024-06-06 00:35:29 +0200
commit0898fee0deacb95bce457f042eeeb9cfdd082ff6 (patch)
tree1df9623010249e4b47a86281c6486a1c966fa4fd /nixos
parenta720a0fb918f6e0c5f65f6cb0e90232c3d9e83c6 (diff)
nixos/opengl: remove with lib over entire file
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/hardware/opengl.nix54
1 files changed, 26 insertions, 28 deletions
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;
   };
 }