Skip to content
Ota edited this page Oct 4, 2026 · 2 revisions

Nvidia

Alice has one generic Nvidia module. It has no preset yet.

Item Name File
Module self.custom.hardwareModules.hardwareNvidia modules/hardware/drivers/nvidia.nix

The module declares options in hardware.alice.nvidia. No host imports it today. Tanuki does not use this module. It sets PRIME offload and Nvidia power management in asusSettings and gets its Nvidia profile from nixos-hardware.

Options

Option Default Effect
enable false Turns on the Nvidia module.
open true Uses the open kernel modules (Turing, RTX 20xx and newer). Set false for Maxwell, Pascal and Volta.
driver "stable" Driver branch: stable, beta, production, legacy-470 or legacy-390.
modesetting true Turns on kernel modesetting. Wayland needs it.
forceFullCompositionPipeline false Fixes screen tearing. It costs some performance.
powerManagement.enable false Turns on Nvidia runtime power management.
powerManagement.finegrained false Lets the GPU power down when idle. Turing and newer only. Needs prime.mode = "offload".
prime.enable false Turns on PRIME hybrid graphics.
prime.mode "offload" offload, sync or reverse-sync. See below.
prime.nvidiaBusId "" PCI bus ID of the Nvidia GPU.
prime.intelBusId "" PCI bus ID of the Intel iGPU. Leave empty for an AMD iGPU.
prime.amdBusId "" PCI bus ID of the AMD iGPU. Leave empty for an Intel iGPU.

PRIME modes

Mode Behavior
offload The iGPU is the default. The Nvidia GPU runs a program on demand with nvidia-offload.
sync The Nvidia GPU is always on. The iGPU output goes through the Nvidia GPU.
reverse-sync The Nvidia GPU is always on. The iGPU drives the display.

Find the bus IDs

  1. Run lspci | grep -E "VGA|3D".
  2. Read the address of each GPU, for example c1:00.0.
  3. Convert each hexadecimal number to decimal: c1:00.0 becomes PCI:193:0:0.

What the module sets

  • nixpkgs.config.allowUnfree is true (as a default). See Troubleshooting if your host sets allowUnfree to false.
  • services.xserver.videoDrivers is ["nvidia"].
  • hardware.graphics is on, with 32-bit support.
  • nvidia_uvm loads as a kernel module when open is true.
  • These session variables are set: LIBVA_DRIVER_NAME = "nvidia", __GLX_VENDOR_LIBRARY_NAME = "nvidia" and GBM_BACKEND = "nvidia-drm".

On a hybrid laptop in offload mode, a global GBM_BACKEND or __GLX_VENDOR_LIBRARY_NAME can send all programs to the Nvidia GPU. If you see this, override the variables in your host.

Assertions

The build stops with a message when prime.enable is true and both prime.intelBusId and prime.amdBusId are empty.

Vulkan

The hardware.alice.vulkan module supports two Nvidia paths:

  • defaultDriver = "nvidia" uses the proprietary driver. This module places the driver files.
  • nvidia.nvk = true adds NVK from Mesa. Use it only without the proprietary driver. defaultDriver = "nvk" needs it.

Example: hybrid laptop with an AMD iGPU

{
  imports = [self.custom.hardwareModules.hardwareNvidia];
  hardware.alice.nvidia = {
    enable = true;
    powerManagement.enable = true;
    prime = {
      enable = true;
      mode = "offload";
      nvidiaBusId = "PCI:1:0:0";
      amdBusId = "PCI:6:0:0";
    };
  };
}

If more than one host needs the same values, make a preset in modules/hardware/settings/. See Design.

Clone this wiki locally