mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
[Hardware/Mesa] Use optimized mesa using optimizePkg from optimizations option
This commit is contained in:
parent
3145509fcc
commit
8b87ab5f2d
1 changed files with 23 additions and 7 deletions
|
|
@ -1,9 +1,11 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, options, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.aviallon.hardware.mesa;
|
cfg = config.aviallon.hardware.mesa;
|
||||||
devCfg = config.aviallon.developer;
|
devCfg = config.aviallon.developer;
|
||||||
generalCfg = config.aviallon.general;
|
generalCfg = config.aviallon.general;
|
||||||
|
optimizationsCfg = config.aviallon.optimizations;
|
||||||
|
optimizePkg = optimizationsCfg.optimizePkg;
|
||||||
packageWithDefaults = types.package // {
|
packageWithDefaults = types.package // {
|
||||||
merge = loc: defs:
|
merge = loc: defs:
|
||||||
let res = mergeDefaultOption loc defs;
|
let res = mergeDefaultOption loc defs;
|
||||||
|
|
@ -26,28 +28,42 @@ in {
|
||||||
example = false;
|
example = false;
|
||||||
};
|
};
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
internal = true;
|
|
||||||
default = pkgs.mesa;
|
default = pkgs.mesa;
|
||||||
type = packageWithDefaults;
|
type = packageWithDefaults;
|
||||||
description = "What mesa package to use";
|
description = "What mesa package to use";
|
||||||
};
|
};
|
||||||
package32 = mkOption {
|
package32 = mkOption {
|
||||||
internal = true;
|
|
||||||
default = pkgs.driversi686Linux.mesa;
|
default = pkgs.driversi686Linux.mesa;
|
||||||
type = packageWithDefaults;
|
type = packageWithDefaults;
|
||||||
description = "What mesa package to use";
|
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 {
|
config = mkIf cfg.enable {
|
||||||
programs.corectrl.enable = mkDefault config.hardware.opengl.enable;
|
programs.corectrl.enable = mkDefault config.hardware.opengl.enable;
|
||||||
|
|
||||||
aviallon.hardware.mesa.package = mkIf cfg.optimized pkgs.mesaOptimized;
|
aviallon.hardware.mesa.internal = mkIf cfg.optimized {
|
||||||
#aviallon.hardware.mesa.package32 = mkIf (mkDefault cfg.optimized pkgs.driversi686Linux.mesaOptimized);
|
package = mkDefault (
|
||||||
|
optimizePkg { } cfg.package);
|
||||||
|
package32 = mkDefault (
|
||||||
|
optimizePkg { } cfg.package32);
|
||||||
|
};
|
||||||
|
|
||||||
hardware.opengl = {
|
hardware.opengl = {
|
||||||
package = with pkgs; cfg.package.drivers;
|
package = with pkgs; cfg.internal.package.drivers;
|
||||||
package32 = with pkgs; cfg.package32.drivers;
|
package32 = with pkgs; cfg.internal.package32.drivers;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue