mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
[Mesa+Hardware] move Mesa specific options to a dedicated files
This commit is contained in:
parent
250820cb82
commit
d3e80fda86
7 changed files with 58 additions and 13 deletions
|
|
@ -4,7 +4,6 @@ let
|
||||||
cfg = config.aviallon.hardware.amd;
|
cfg = config.aviallon.hardware.amd;
|
||||||
devCfg = config.aviallon.developer;
|
devCfg = config.aviallon.developer;
|
||||||
generalCfg = config.aviallon.general;
|
generalCfg = config.aviallon.general;
|
||||||
myMesa = if generalCfg.unsafeOptimizations then pkgs.mesaOptimized else pkgs.mesa;
|
|
||||||
in {
|
in {
|
||||||
config = mkIf (cfg.enable && cfg.kernelDriver == "amdgpu") {
|
config = mkIf (cfg.enable && cfg.kernelDriver == "amdgpu") {
|
||||||
boot.initrd.kernelModules = [ "amdgpu" ];
|
boot.initrd.kernelModules = [ "amdgpu" ];
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,7 @@
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.aviallon.hardware.amd;
|
cfg = config.aviallon.hardware.amd;
|
||||||
devCfg = config.aviallon.developer;
|
|
||||||
generalCfg = config.aviallon.general;
|
generalCfg = config.aviallon.general;
|
||||||
myMesa = if generalCfg.unsafeOptimizations then pkgs.mesaOptimized else pkgs.mesa;
|
|
||||||
in {
|
in {
|
||||||
options.aviallon.hardware.amd = {
|
options.aviallon.hardware.amd = {
|
||||||
enable = mkEnableOption "AMD gpus";
|
enable = mkEnableOption "AMD gpus";
|
||||||
|
|
@ -28,18 +26,11 @@ in {
|
||||||
];
|
];
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
programs.corectrl.enable = mkIf generalCfg.unsafeOptimizations true;
|
|
||||||
|
|
||||||
hardware.opengl = {
|
hardware.opengl = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = with pkgs; myMesa.drivers;
|
|
||||||
package32 = with pkgs; myMesa.drivers;
|
|
||||||
extraPackages = with pkgs; mkIf (!cfg.useProprietary) (mkAfter [
|
|
||||||
(hiPrio myMesa)
|
|
||||||
]);
|
|
||||||
extraPackages32 = with pkgs.driversi686Linux; mkIf (!cfg.useProprietary) [
|
|
||||||
(hiPrio myMesa)
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
aviallon.hardware.mesa.enable = mkDefault (!cfg.useProprietary);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ let
|
||||||
cfg = config.aviallon.hardware.amd;
|
cfg = config.aviallon.hardware.amd;
|
||||||
devCfg = config.aviallon.developer;
|
devCfg = config.aviallon.developer;
|
||||||
generalCfg = config.aviallon.general;
|
generalCfg = config.aviallon.general;
|
||||||
myMesa = if generalCfg.unsafeOptimizations then pkgs.mesaOptimized else pkgs.mesa;
|
|
||||||
in {
|
in {
|
||||||
config = mkIf (cfg.enable && cfg.kernelDriver == "radeon") {
|
config = mkIf (cfg.enable && cfg.kernelDriver == "radeon") {
|
||||||
boot.initrd.kernelModules = [ "radeon" ];
|
boot.initrd.kernelModules = [ "radeon" ];
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ in
|
||||||
./amd
|
./amd
|
||||||
./nvidia
|
./nvidia
|
||||||
./intel
|
./intel
|
||||||
|
./mesa.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|
|
||||||
|
|
@ -51,5 +51,6 @@ in
|
||||||
// {
|
// {
|
||||||
"i915.fastboot" = 1;
|
"i915.fastboot" = 1;
|
||||||
};
|
};
|
||||||
|
aviallon.hardware.mesa.enable = mkDefault true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
53
hardware/mesa.nix
Normal file
53
hardware/mesa.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.aviallon.hardware.mesa;
|
||||||
|
devCfg = config.aviallon.developer;
|
||||||
|
generalCfg = config.aviallon.general;
|
||||||
|
packageWithDefaults = types.package // {
|
||||||
|
merge = loc: defs:
|
||||||
|
let res = mergeDefaultOption loc defs;
|
||||||
|
in if builtins.isPath res || (builtins.isString res && ! builtins.hasContext res)
|
||||||
|
then toDerivation res
|
||||||
|
else res;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.aviallon.hardware.mesa = {
|
||||||
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
type = types.bool;
|
||||||
|
description = "Wether to enable mesa specific configuration";
|
||||||
|
example = true;
|
||||||
|
};
|
||||||
|
optimized = mkOption {
|
||||||
|
default = generalCfg.unsafeOptimizations;
|
||||||
|
type = types.bool;
|
||||||
|
description = "Wether to enable (unsafe) mesa optimizations";
|
||||||
|
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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
hardware.opengl = {
|
||||||
|
package = with pkgs; cfg.package.drivers;
|
||||||
|
package32 = with pkgs; cfg.package32.drivers;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -14,5 +14,6 @@ in {
|
||||||
"nouveau.config" = "NvBoost=1";
|
"nouveau.config" = "NvBoost=1";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
aviallon.hardware.mesa.enable = mkDefault true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue