49 lines
1.1 KiB
Nix
49 lines
1.1 KiB
Nix
{ lib, pkgs, config, ... }:
|
|
with lib;
|
|
let
|
|
cfg = config.share.hardware.amd;
|
|
in {
|
|
imports = [
|
|
./options.nix
|
|
];
|
|
|
|
config = mkIf cfg.enable {
|
|
boot.kernelParams = [ (if cfg.corectrl.enable then "amdgpu.ppfeaturemask=0xffffffff" else "") ];
|
|
|
|
# Configure programs
|
|
programs.corectrl.enable = cfg.corectrl.enable;
|
|
|
|
# Configure environment
|
|
environment = {
|
|
# Force radv
|
|
variables.AMD_VULKAN_ICD = "RADV";
|
|
};
|
|
|
|
# Hardware configs
|
|
hardware = {
|
|
# Enable OpenGL
|
|
opengl = {
|
|
enable = true;
|
|
driSupport = true;
|
|
driSupport32Bit = true;
|
|
};
|
|
};
|
|
|
|
# Configure polkit
|
|
security.polkit = {
|
|
enable = cfg.corectrl.enablePolkit;
|
|
extraConfig = ''
|
|
polkit.addRule(function(action, subject) {
|
|
if ((action.id == "org.corectrl.helper.init" ||
|
|
action.id == "org.corectrl.helperkiller.init") &&
|
|
subject.local == true &&
|
|
subject.active == true &&
|
|
subject.isInGroup("${cfg.corectrl.polkitGroup}")) {
|
|
return polkit.Result.YES;
|
|
}
|
|
});
|
|
'';
|
|
};
|
|
};
|
|
}
|