config/hardware/gpu/rocm.nix

36 lines
1.2 KiB
Nix
Raw Normal View History

2023-03-09 09:28:11 +01:00
{ pkgs, ... }:
{
# assumes common-gpu-amd from nixos-hardware is also added
2023-03-19 04:23:38 +01:00
# TODO: should we move it from flake.nix to here?
2023-11-10 22:54:26 +01:00
# nixos-hardware common-amd options
# https://github.com/NixOS/nixos-hardware/blob/master/common/gpu/amd/default.nix
2023-06-23 21:45:16 +02:00
hardware.amdgpu.opencl = true;
2023-11-10 22:54:26 +01:00
hardware.amdgpu.amdvlk = true;
2023-06-23 21:45:16 +02:00
2023-11-10 22:54:26 +01:00
hardware.opengl.enable = true;
# https://libreddit.noximilien.pbsds.net/r/archlinux/comments/nih9c9/amdgpu_vs_modesetting_in_current_510_kernels_xorg/
services.xserver.videoDrivers = [ "amdgpu" ]; # use gpu, adaptive sync and and hardware page flipping
#services.xserver.videoDrivers = [ "modesetting" ]; # integrated (non-accelerated) framebuffer, KMS
hardware.opengl.driSupport = true;
hardware.opengl.driSupport32Bit = true;
hardware.opengl.extraPackages = [
pkgs.rocm-opencl-icd
pkgs.rocm-runtime#-ext
];
2023-03-19 04:23:38 +01:00
2023-06-23 21:45:16 +02:00
nixpkgs.config.openglSupport = true; # why is this not set by hardware.opengl.enable ?
2023-06-19 02:45:50 +02:00
nixpkgs.config.rocmSupport = true;
2023-06-24 14:48:53 +02:00
nixpkgs.config.vdpauSupport = true;
nixpkgs.config.vaapiSupport = true;
2023-06-19 02:45:50 +02:00
2023-11-10 22:54:26 +01:00
# https://nixos.wiki/wiki/AMD_GPU#HIP
2023-03-09 09:28:11 +01:00
systemd.tmpfiles.rules = [
"L+ /opt/rocm/hip - - - - ${pkgs.hip}"
];
2023-11-10 22:54:26 +01:00
2023-03-09 09:28:11 +01:00
environment.systemPackages = with pkgs; [
2023-06-23 21:45:16 +02:00
nvtop-amd
2023-03-09 09:28:11 +01:00
];
}