Files
NixOsConfig/modules/nixos/hardware/amd.nix
T
Claude 7dd6853124 Normalize file modes to 644
All tracked files were committed as 755; only Nix reads them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JZ16yf4acmaSiHq81vyQ6Z
2026-10-12 20:41:48 +00:00

72 lines
1.8 KiB
Nix

# AMD CPU + Radeon GPU. nixos-hardware (common-cpu-amd, -pstate, -gpu-amd,
# -pc-ssd) is imported by the host; defaults that overlap use mkDefault.
{
config,
lib,
pkgs,
...
}:
let
cfg = config.my.hardware.amd;
in
{
options.my.hardware.amd = {
enable = lib.mkEnableOption "AMD CPU and Radeon GPU support";
rocm.enable = lib.mkEnableOption "ROCm/HIP compute stack (rocminfo, rocm-smi, /opt/rocm/hip)";
lact.enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "LACT daemon for GPU monitoring, fan curves and overclocking.";
};
};
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
hardware = {
graphics = {
enable = true;
# Steam/Proton and Wine need the 32-bit Mesa drivers.
enable32Bit = true;
};
amdgpu = {
initrd.enable = lib.mkDefault true;
opencl.enable = true;
};
cpu.amd.updateMicrocode = lib.mkDefault true;
};
boot.kernelModules = [ "kvm-amd" ];
environment.systemPackages = with pkgs; [
vulkan-tools
mesa-demos
radeontop
nvtopPackages.amd
lm_sensors
];
}
(lib.mkIf cfg.lact.enable {
services.lact.enable = true;
# LACT needs the overdrive bit in amdgpu.ppfeaturemask to tune clocks.
hardware.amdgpu.overdrive.enable = true;
})
(lib.mkIf cfg.rocm.enable {
environment.systemPackages = with pkgs.rocmPackages; [
rocminfo
rocm-smi
];
# Many HIP applications look for the runtime in /opt/rocm/hip.
systemd.tmpfiles.rules = [ "L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}" ];
})
]
);
}