71 lines
1.6 KiB
Nix
Executable File
71 lines
1.6 KiB
Nix
Executable File
{
|
|
lib,
|
|
pkgs,
|
|
config,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.share.hardware.amd;
|
|
pkgsVersion = pkgs; # .unstable;
|
|
in
|
|
{
|
|
imports = [ ./options.nix ];
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
boot = {
|
|
kernelModules = [ "nct6775" ];
|
|
kernelParams = [ (if cfg.enable then "amdgpu.ppfeaturemask=0xffffffff" else null) ];
|
|
};
|
|
|
|
# Configure programs
|
|
programs.corectrl = {
|
|
enable = cfg.corectrl.enable;
|
|
package = pkgsVersion.corectrl;
|
|
};
|
|
|
|
# Configure environment
|
|
environment = {
|
|
# Force radv
|
|
variables = {
|
|
AMD_VULKAN_ICD = "RADV";
|
|
STEAM_FORCE_DESKTOPUI_SCALING = "1.0";
|
|
GDK_SCALE = "1";
|
|
};
|
|
};
|
|
|
|
# Configure polkit
|
|
security.polkit = lib.mkIf 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;
|
|
}
|
|
});
|
|
'';
|
|
};
|
|
|
|
# nixpkg is broken so need to manually define
|
|
systemd.services.lactd = lib.mkIf cfg.lact.enable {
|
|
description = "AMDGPU Control Daemon";
|
|
path = with pkgsVersion; [
|
|
bash
|
|
lact
|
|
];
|
|
script = ''
|
|
lact daemon
|
|
'';
|
|
wantedBy = [ "multi-user.target" ];
|
|
after = [ "multi-user.target" ];
|
|
};
|
|
|
|
# Configure environment
|
|
environment = {
|
|
systemPackages = with pkgsVersion; lib.mkIf cfg.lact.enable [ lact ];
|
|
};
|
|
};
|
|
}
|