config/hardware/gpu/rocm.nix

66 lines
2.3 KiB
Nix
Raw Normal View History

2024-07-04 02:16:29 +02:00
{ pkgs, lib, options, ... }: lib.mkMerge [
2023-03-09 09:28:11 +01:00
{
# 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
# https://github.com/NixOS/nixos-hardware/blob/master/common/gpu/amd/default.nix
2023-06-23 21:45:16 +02:00
2023-11-10 22:54:26 +01:00
hardware.opengl.enable = true;
hardware.opengl.driSupport = true;
hardware.opengl.driSupport32Bit = true;
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;
2024-07-04 02:16:29 +02:00
nixpkgs.config.vdpauSupport = true;
nixpkgs.config.vaapiSupport = true;
2023-06-19 02:45:50 +02:00
2024-10-17 22:50:41 +02:00
services.ollama.acceleration = lib.mkDefault "rocm";
2024-07-04 02:16:29 +02:00
}
2024-07-30 02:11:58 +02:00
(lib.mkIf (lib.versionAtLeast (lib.versions.majorMinor lib.version) "24.05") {
2024-07-04 02:16:29 +02:00
hardware.amdgpu.opencl.enable = lib.mkDefault true;
#hardware.amdgpu.amdvlk.enable = lib.mkDefault true;
#hardware.amdgpu.amdvlk.support32Bit.enable = lib.mkDefault true;
})
2024-07-30 02:11:58 +02:00
#(lib.mkIf (lib.versionOlder (lib.versions.majorMinor lib.version) "24.05") {
# # nixos-hardware common-amd options
# # https://github.com/NixOS/nixos-hardware/blob/master/common/gpu/amd/default.nix
# hardware.amdgpu.opencl = lib.mkDefault true;
# #hardware.amdgpu.amdvlk = lib.mkDefault true;
#})
2024-07-04 02:16:29 +02:00
{
2024-02-26 11:08:16 +01:00
# 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 (default in nixos-hardware)
2024-07-04 02:16:29 +02:00
# https://wiki.nixos.org/wiki/AMD_GPU#HIP
2024-01-11 21:57:25 +01:00
systemd.tmpfiles.rules = let
2024-07-04 02:16:29 +02:00
rocmEnv = pkgs.symlinkJoin {
name = "rocm-combined";
paths = with pkgs.rocmPackages; [
rocblas
hipblas
clr
];
};
in [ "L+ /opt/rocm - - - - ${rocmEnv}" ];
nixpkgs.overlays = [
(prev: final: {
blender = prev.blender-hip;
})
2023-03-09 09:28:11 +01:00
];
2023-11-10 22:54:26 +01:00
2024-07-04 02:16:29 +02:00
# enable opencl on polaris, (rx580)
environment.variables.ROC_ENABLE_PRE_VEGA = "1";
environment.systemPackages = [
(pkgs.nvtopPackages.amd or pkgs.nvtop-amd)
pkgs.lact
2023-03-09 09:28:11 +01:00
];
2024-07-04 02:16:29 +02:00
# lact - amdgpu GUI tool
systemd.packages = [ pkgs.lact ];
systemd.services.lactd.enable = true;
systemd.services.lactd.wantedBy = [ "multi-user.target" ]; # add this if you want the unit to auto start at boot time
2023-03-09 09:28:11 +01:00
}
2024-07-04 02:16:29 +02:00
]