69 lines
1.5 KiB
Nix
69 lines
1.5 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.enable then "amdgpu.ppfeaturemask=0xffffffff" else null) ];
|
|
|
|
# Configure programs
|
|
programs.corectrl.enable = cfg.corectrl.enable;
|
|
|
|
# Configure environment
|
|
environment = {
|
|
# Force radv
|
|
variables.AMD_VULKAN_ICD = "RADV";
|
|
};
|
|
|
|
# Hardware configs
|
|
hardware = {
|
|
# Enable graphics
|
|
graphics = {
|
|
enable = true;
|
|
enable32Bit = 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;
|
|
}
|
|
});
|
|
'';
|
|
};
|
|
|
|
# nixpkg is broken so need to manually define
|
|
systemd.services.lactd = mkIf cfg.lact.enable {
|
|
description = "AMDGPU Control Daemon";
|
|
path = [
|
|
pkgs.bash
|
|
pkgs.lact
|
|
];
|
|
script = ''
|
|
lact daemon
|
|
'';
|
|
wantedBy = [ "multi-user.target" ];
|
|
after = [ "multi-user.target" ];
|
|
};
|
|
|
|
# Configure environment
|
|
environment.systemPackages = mkIf cfg.lact.enable [ pkgs.lact ];
|
|
};
|
|
}
|