diff --git a/system/hardware/amdgpu.nix b/system/hardware/amdgpu.nix index ac588ab..121526c 100644 --- a/system/hardware/amdgpu.nix +++ b/system/hardware/amdgpu.nix @@ -9,14 +9,54 @@ with lib; let in { options.mySystem.hardware.amdgpu.enable = mkEnableOption "Enables an AMD GPU configuration"; config = mkIf cfg.enable { - systemd.tmpfiles.rules = [ - "L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}" - ]; - hardware.graphics.extraPackages = with pkgs; [rocmPackages.clr.icd]; + hardware = { + graphics = { + enable = true; + enable32Bit = true; + extraPackages = with pkgs; [ + mesa # Mesa drivers for AMD GPUs + rocmPackages.clr # common language runtime for ROCm + rocmPackages.clr.icd # ROCm ICD for OpenCL + rocmPackages.rocblas # ROCm BLAS library + rocmPackages.hipblas # + rocmPackages.rpp # High-performance computer vision library + nvtopPackages.amd # GPU utilization monitoring + ]; + }; + amdgpu = { + initrd.enable = true; + opencl.enable = true; + }; + }; environment.systemPackages = with pkgs; [ clinfo amdgpu_top nvtopPackages.amd ]; + systemd = { + packages = with pkgs; [lact]; + services.lactd.wantedBy = ["multi-user.target"]; + tmpfiles.rules = let + rocmEnv = pkgs.symlinkJoin { + name = "rocm-combined"; + paths = with pkgs.rocmPackages; [ + clr + clr.icd + rocblas + hipblas + rpp + ]; + }; + in [ + "L+ /opt/rocm - - - - ${rocmEnv}" + ]; + }; + environment.variables = { + ROCM_PATH = "/opt/rocm"; # Set ROCm path + HIP_VISIBLE_DEVICES = "1"; # Use only the eGPU (ID 1) + ROCM_VISIBLE_DEVICES = "1"; # Optional: ROCm equivalent for visibility + # LD_LIBRARY_PATH = "/opt/rocm/lib"; # Add ROCm libraries + HSA_OVERRIDE_GFX_VERSION = "10.3.0"; # Set GFX version override + }; }; }