From 8b87ab5f2d452bc49888412b3600fa6eb4e53842 Mon Sep 17 00:00:00 2001 From: Antoine Viallon Date: Tue, 2 May 2023 20:39:45 +0200 Subject: [PATCH] [Hardware/Mesa] Use optimized mesa using optimizePkg from optimizations option --- hardware/mesa.nix | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/hardware/mesa.nix b/hardware/mesa.nix index ceb7637..afea435 100644 --- a/hardware/mesa.nix +++ b/hardware/mesa.nix @@ -1,9 +1,11 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, lib, options, ... }: with lib; let cfg = config.aviallon.hardware.mesa; devCfg = config.aviallon.developer; generalCfg = config.aviallon.general; + optimizationsCfg = config.aviallon.optimizations; + optimizePkg = optimizationsCfg.optimizePkg; packageWithDefaults = types.package // { merge = loc: defs: let res = mergeDefaultOption loc defs; @@ -26,28 +28,42 @@ in { example = false; }; package = mkOption { - internal = true; default = pkgs.mesa; type = packageWithDefaults; description = "What mesa package to use"; }; package32 = mkOption { - internal = true; default = pkgs.driversi686Linux.mesa; type = packageWithDefaults; description = "What mesa package to use"; }; + + internal.package = mkOption { + internal = true; + type = packageWithDefaults; + default = cfg.package; + }; + + internal.package32 = mkOption { + internal = true; + type = packageWithDefaults; + default = cfg.package32; + }; }; config = mkIf cfg.enable { programs.corectrl.enable = mkDefault config.hardware.opengl.enable; - aviallon.hardware.mesa.package = mkIf cfg.optimized pkgs.mesaOptimized; - #aviallon.hardware.mesa.package32 = mkIf (mkDefault cfg.optimized pkgs.driversi686Linux.mesaOptimized); + aviallon.hardware.mesa.internal = mkIf cfg.optimized { + package = mkDefault ( + optimizePkg { } cfg.package); + package32 = mkDefault ( + optimizePkg { } cfg.package32); + }; hardware.opengl = { - package = with pkgs; cfg.package.drivers; - package32 = with pkgs; cfg.package32.drivers; + package = with pkgs; cfg.internal.package.drivers; + package32 = with pkgs; cfg.internal.package32.drivers; }; }; }