Skip to content

add gpuBackend/gpuAdapter module options for wgpu device selection under Nix#117

Merged
orhun merged 2 commits into
orhun:mainfrom
DarthPJB:feat/nix-module-gpu-options
Jun 30, 2026
Merged

add gpuBackend/gpuAdapter module options for wgpu device selection under Nix#117
orhun merged 2 commits into
orhun:mainfrom
DarthPJB:feat/nix-module-gpu-options

Conversation

@DarthPJB

Copy link
Copy Markdown
Contributor

The NixOS and Home Manager modules now expose two options for controlling wgpu device selection:
programs.ratty = {
gpuBackend = "vulkan"; # "vulkan" | "gl" | "gles" | null
gpuAdapter = "RTX 3060"; # substring match | null
};
gpuBackend — Sets WGPU_BACKEND to force the graphics API. Cases:

  • "vulkan" — Explicit Vulkan path. Needed when the default backend auto-detection picks a broken backend, or when testing driver-specific behaviour.
  • "gl" / "gles" — OpenGL fallback. Useful on systems where Vulkan is unavailable or broken (headless, VNC, older hardware, driver bugs).
  • null — Auto-detect (default). wgpu picks the best available backend.
    gpuAdapter — Sets WGPU_ADAPTER_NAME to select a specific GPU by name substring. Cases:
  • Multi-GPU systems (integrated + discrete, or dual discrete) where wgpu picks the wrong adapter.
  • Testing against a specific GPU without disabling others in BIOS.
  • Offloading rendering to a secondary GPU while keeping the primary for display.
    The NixOS module composes these into a single makeWrapper call alongside the existing --config-file flag. The Home Manager module sets them via home.sessionVariables.

@DarthPJB

Copy link
Copy Markdown
Contributor Author

@orhun - I am unsure if this is the best way to pass in an environment variable like this; I am not 'rust-native' - Please feel free to amend the approach or suggest a better methodology.

@DarthPJB DarthPJB force-pushed the feat/nix-module-gpu-options branch from b253cbc to aff276c Compare June 23, 2026 14:49

@orhun orhun left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@orhun orhun merged commit d0c4d7f into orhun:main Jun 30, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants