How to use discrete amd gpu in bottles (or globally)

After about a month of using Nixos, I realized my apps don’t use my discrete gpu. I have an intel cpu with integrated graphics and a discrete amd gpu. On windows I had set all apps to use discrete gpu when the laptop was on power. Before I say more, some info for my system:

Fastfetch output

OS: NixOS 25.05 (Warbler) x86_64

Host: Inspiron 5567

Kernel: Linux 6.12.12

DE: KDE Plasma

WM: KWin (Wayland)

WM Theme: Breeze

Theme: Breeze (Dark) [Qt]

Icons: breeze-dark [Qt], breeze-dark [GTK2/3/4]

Font: Noto Sans (10pt) [Qt], Noto Sans (10pt) [GTK2/3/4]

Cursor: breeze (24px)

Terminal: konsole 24.12.1

CPU: Intel(R) Core™ i5-7200U (4) @ 3.10 GHz

GPU 1: AMD Radeon R5 M445 Series [Discrete]

GPU 2: Intel HD Graphics 620 @ 1.00 GHz [Integrated]

Memory: 3.23 GiB / 23.37 GiB (14%)

Swap: Disabled

Disk (/): 88.15 GiB / 195.85 GiB (45%) - ext4

Disk (/home): 514.67 GiB / 716.87 GiB (72%) - ext4

Locale: en_US.UTF-8

My main issue is that my bottles apps (bottles is a wine prefix manager) can’t run its wine prefixes with a discrete gpu. I have the nixpkgs version of bottles (not the flatpak one which the developer suggests using). Things I’ve tried:

  • Enabling/Disabling the “use discrete graphics” option inside the bottle (only the integrated gpu is being used)
  • Launching bottles from command line with DRI_PRIME=1 and bottles opened for a little and then closed, by reporting this:
terminal output
(process:4413): Gtk-WARNING **: 10:35:38.358: Unknown key gtk-modules in /home/bs/.config/gtk-4.0/settings.ini

(process:4413): Adwaita-WARNING **: 10:35:38.384: Using GtkSettings:gtk-application-prefer-dark-theme with libadwaita is unsupported. Please use AdwStyleManager:color-scheme instead.

(bottles:4413): Gtk-WARNING **: 10:35:39.395: Theme parser warning: style.css:184:3-185:1: Expected ';' at end of block

(bottles:4413): Gtk-WARNING **: 10:35:39.395: Theme parser warning: style-dark.css:23:3-24:1: Expected ';' at end of block
10:35:39 (INFO) Launching with URI: None 
10:35:39 (INFO) [Activate] request received. 
10:35:39 (WARNING) Bottles is only supported within a sandboxed format. Official sources of Bottles are available at: 
10:35:39 (WARNING) https://usebottles.com/download/ 
10:35:39 (WARNING) Please report any issues at: https://github.com/NixOS/nixpkgs/issues 
10:35:39 (INFO) Bottles Started! 
  • Launching the game from command line with DRI_PRIME=1 bottles-cli run -p OuterWilds -b Outer_Wilds after having enabled/disabled the “use discrete graphics” option inside the bottle (kept using the integrated graphics instead)
  • Launching the game from bottles gui, after using the enviroment variable DRI_PRIME=1 and enabling/disabling the “use discrete gpu” option (kept using the integrated graphics instead)
  • Adding the following code to my configuration.nix:
    hardware.graphics = {
    enable = true;
    enable32Bit = true;
    };
    
  • Launching the game from bottles gui, after using the enviroment variable DRI_PRIME=1 DXVK_FILTER_DEVICE_NAME="AMD Radeon R5 M445 Series (RADV ICELAND)" and enabling/disabling the “use discrete gpu” option (it told me that I don’t have directX11 installed, but the game should run without it according to steamdb)
  • Setting KDE power profile from “Balanced” to “Performance”

Note that I can launch native apps with discrete gpu by typing in the terminal DRI_PRIME=1 $program_name, where $program_name is the name of the program I want to launch (like SuperTuxKart).

Is there a way to launch bottle apps with my discrete gpu or at least run all of my apps with my discrete gpu? Some extra related links I found, but didn’t solve my issue:

Links

I’m not sure how to specify the GPU to use on a per application basis.

But to disable the integrated CPU globally, you could adopt this config snippet. It disables the integrated Intel GPU in favor of a dedicated AMD GPU. The system is quite old, so make sure to adjust the kernel modules and parameters to your setup. But this might help you forward!

  # Disable `i915` (onboard Intel GPU).
  #   https://github.com/NixOS/nixos-hardware/blob/2eccff41bab80839b1d25b303b53d339fbb07087/common/gpu/intel/disable.nix
  #   https://discourse.nixos.org/t/fully-disabling-the-nvidia-dgpu-on-an-optimus-laptop/29686/6
  # Disable `radeon` so that `amdgpu` is used instead.
  #   https://nixos.wiki/wiki/AMD_GPU#Enable_Southern_Islands_.28SI.29_and_Sea_Islands_.28CIK.29_support
  boot.blacklistedKernelModules = [ "i915" ];
  boot.kernelParams = [ "i915.modeset=0" "radeon.si_support=0" "amdgpu.si_support=1" ];

Oh thanks for the reply! May I ask, where should I put the boot.blacklistedKernelModules = [ "i915" ]; line? In configuration.nix?

Also, it apprears that my gpu is gcn3.0 AMD Radeon R5 M445 Specs | TechPowerUp GPU Database so I suppose I dont need this line: boot.kernelParams = [ "i915.modeset=0" "radeon.si_support=0" "amdgpu.si_support=1" ];

I’m back and well, it didn’t work.
I added those two lines in Configuration.nix:

  boot.blacklistedKernelModules = [ "i915" ];
  boot.initrd.kernelModules = [ "amdgpu" ];

It seems like it now uses the cpu to render the graphics. I tried to launch an app with bottles and it could not detect any gpu.

vulkaninfo --summary returns this:

Summary

WARNING: [Loader Message] Code 0 : terminator_CreateInstance: Received return code -3 from call to vkCreateInstance in ICD /nix/store/dax001xkrfy0s09v98ha0rsz4i9cdz8z-mesa-24.3.4-drivers/lib/libvulkan_dzn.so. Skipping this driver.
vulkan: No DRI3 support detected - required for presentation
Note: you can probably enable DRI3 in your Xorg config
vulkan: No DRI3 support detected - required for presentation
Note: you can probably enable DRI3 in your Xorg config
vulkan: No DRI3 support detected - required for presentation
Note: you can probably enable DRI3 in your Xorg config
vulkan: No DRI3 support detected - required for presentation
Note: you can probably enable DRI3 in your Xorg config
vulkan: No DRI3 support detected - required for presentation
Note: you can probably enable DRI3 in your Xorg config
vulkan: No DRI3 support detected - required for presentation
Note: you can probably enable DRI3 in your Xorg config
vulkan: No DRI3 support detected - required for presentation
Note: you can probably enable DRI3 in your Xorg config
vulkan: No DRI3 support detected - required for presentation
Note: you can probably enable DRI3 in your Xorg config

VULKANINFO

Vulkan Instance Version: 1.3.296

Instance Extensions: count = 24

VK_EXT_acquire_drm_display : extension revision 1
VK_EXT_acquire_xlib_display : extension revision 1
VK_EXT_debug_report : extension revision 10
VK_EXT_debug_utils : extension revision 2
VK_EXT_direct_mode_display : extension revision 1
VK_EXT_display_surface_counter : extension revision 1
VK_EXT_headless_surface : extension revision 1
VK_EXT_surface_maintenance1 : extension revision 1
VK_EXT_swapchain_colorspace : extension revision 5
VK_KHR_device_group_creation : extension revision 1
VK_KHR_display : extension revision 23
VK_KHR_external_fence_capabilities : extension revision 1
VK_KHR_external_memory_capabilities : extension revision 1
VK_KHR_external_semaphore_capabilities : extension revision 1
VK_KHR_get_display_properties2 : extension revision 1
VK_KHR_get_physical_device_properties2 : extension revision 2
VK_KHR_get_surface_capabilities2 : extension revision 1
VK_KHR_portability_enumeration : extension revision 1
VK_KHR_surface : extension revision 25
VK_KHR_surface_protected_capabilities : extension revision 1
VK_KHR_wayland_surface : extension revision 6
VK_KHR_xcb_surface : extension revision 6
VK_KHR_xlib_surface : extension revision 6
VK_LUNARG_direct_driver_loading : extension revision 1

Instance Layers: count = 3

VK_LAYER_INTEL_nullhw INTEL NULL HW 1.1.73 version 1
VK_LAYER_MESA_device_select Linux device selection layer 1.3.211 version 1
VK_LAYER_MESA_overlay Mesa Overlay layer 1.3.211 version 1

Devices:

GPU0:
apiVersion = 1.3.296
driverVersion = 24.3.4
vendorID = 0x1002
deviceID = 0x6900
deviceType = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
deviceName = AMD Radeon R5 M445 Series (RADV ICELAND)
driverID = DRIVER_ID_MESA_RADV
driverName = radv
driverInfo = Mesa 24.3.4
conformanceVersion = 1.2.7.1
deviceUUID = 00000000-0100-0000-0000-000000000000
driverUUID = 414d442d-4d45-5341-2d44-525600000000
GPU1:
apiVersion = 1.3.296
driverVersion = 0.0.1
vendorID = 0x10005
deviceID = 0x0000
deviceType = PHYSICAL_DEVICE_TYPE_CPU
deviceName = llvmpipe (LLVM 19.1.6, 256 bits)
driverID = DRIVER_ID_MESA_LLVMPIPE
driverName = llvmpipe
driverInfo = Mesa 24.3.4 (LLVM 19.1.6)
conformanceVersion = 1.3.1.1
deviceUUID = 6d657361-3234-2e33-2e34-000000000000
driverUUID = 6c6c766d-7069-7065-5555-494400000000

I see with the resources program that the discrete gpu is not being used. Also the colors of the display seem to be washed off and the framerate to be dropped. I will revert the changes.

It was really a good idea to turn off the integrated gpu, but it seems like it doesn’t work.

You could try to only disable the Intel GPU (see nixos-hardware/common/gpu/intel/disable.nix at 2eccff41bab80839b1d25b303b53d339fbb07087 · NixOS/nixos-hardware · GitHub).

boot.blacklistedKernelModules = [ "i915" ];
boot.kernelParams = [ "i915.modeset=0" ];

Other kernel parameters for your AMD GPU should not be required as that is done by the hardware.graphics option. Sorry if my initial answer was a bit confusing.

Just tried it, but still doesn’t work, same results as above.

Thank you for trying:)