From 3634e47486c218e3a1f756375645773c02432d05 Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L. de Mello" Date: Wed, 21 Feb 2024 18:50:31 -0300 Subject: [PATCH] fix: amd gpu support --- hosts/desktop/gpu-configuration.nix | 30 ++++++++++++++++++++++++++ hosts/desktop/shared-configuration.nix | 5 +---- 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 hosts/desktop/gpu-configuration.nix diff --git a/hosts/desktop/gpu-configuration.nix b/hosts/desktop/gpu-configuration.nix new file mode 100644 index 0000000..53d1d24 --- /dev/null +++ b/hosts/desktop/gpu-configuration.nix @@ -0,0 +1,30 @@ +{ config, pkgs, ... }: + +{ + imports = [ ]; + options.shared.configuration.gpu = { }; + config = { + boot.initrd.kernelModules = [ "amdgpu" ]; + services.xserver.videoDrivers = [ "amdgpu" ]; + + environment = { + variables = { + ROC_ENABLE_PRE_VEGA = "1"; + }; + systemPackages = with pkgs; [ + clinfo + ]; + }; + + hardware.opengl = { + enable = true; + extraPackages = with pkgs; [ + amdvlk + rocmPackages.clr.icd + ]; + driSupport = true; + driSupport32Bit = true; + }; + + }; +} diff --git a/hosts/desktop/shared-configuration.nix b/hosts/desktop/shared-configuration.nix index 7058ebe..8bcc4aa 100644 --- a/hosts/desktop/shared-configuration.nix +++ b/hosts/desktop/shared-configuration.nix @@ -7,6 +7,7 @@ ../../modules/nixos/systems/fonts.nix # Include the results of the hardware scan. ./hardware-configuration.nix + ./gpu-configuration.nix ]; options.shared.configuration = { }; config = { @@ -81,10 +82,6 @@ wl-clipboard ]; - hardware = { - opengl.enable = true; - }; - # Enable the X11 windowing system. services.xserver.enable = true;