From a8f78f35db1d3eaca5e3b8a7e093b56e29ca3ae2 Mon Sep 17 00:00:00 2001 From: Antoine Viallon Date: Mon, 27 Feb 2023 19:42:52 +0100 Subject: [PATCH] [Hardware/AMD] Fix Mesa RADV not being preferred over AMDVLK --- hardware/amd.nix | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/hardware/amd.nix b/hardware/amd.nix index 676aff4..8bae9e2 100644 --- a/hardware/amd.nix +++ b/hardware/amd.nix @@ -9,6 +9,11 @@ in options.aviallon.hardware.amd = { enable = mkEnableOption "AMD gpus"; useProprietary = mkEnableOption "Use proprietary AMDGPU Pro"; + defaultVulkanImplementation = mkOption { + description = "Wether to use RADV or AMDVLK by default"; + type = with types; enum [ "amdvlk" "radv" ]; + default = "radv"; + }; }; config = mkIf (cfg.enable) { @@ -44,15 +49,20 @@ in ]; hardware.opengl.enable = true; - hardware.opengl.extraPackages = with pkgs; mkIf (!cfg.useProprietary) [ + hardware.opengl.extraPackages = with pkgs; mkIf (!cfg.useProprietary) (mkAfter [ rocm-opencl-icd rocm-opencl-runtime + mesa amdvlk - ]; + ]); + + environment.variables = { + "AMD_VULKAN_ICD" = strings.toUpper cfg.defaultVulkanImplementation; + }; hardware.opengl.extraPackages32 = with pkgs.driversi686Linux; mkIf (!cfg.useProprietary) [ - amdvlk mesa + amdvlk ]; # Make rocblas and rocfft work