Files
NixOsConfig/modules/nixos/hardware/amd.nix
T
Claude 0ce9943d56 Add NixOS modules: boot, users, AMD, disko layout, secrets, Hyprland, Steam
- my.disks generates disko: NVMe btrfs (@root/@home/@nix/@log/@swap) + SATA SSD
  btrfs with one subvolume per ~/Games, Downloads, Documents, Music, Pictures,
  Videos, Storage (nofail)
- lanzaboote Secure Boot, systemd initrd, latest kernel
- AMD CPU/GPU: amdgpu initrd, OpenCL, LACT, optional ROCm
- agenix with host-key identity, optional password and SSH key secrets
- Hyprland (UWSM, XWayland) + greetd/tuigreet, Noctalia services, PipeWire, fonts
- Steam + Proton-GE, gamescope, gamemode
- overlays: compose Hyprland's hyprland-packages + hyprland-extras (upstream
  default lacks the hyprwm dependency overlays)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J1cugeLkfFLZMpiztQ8TyN
2026-10-11 12:38:52 +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}" ];
})
]
);
}