Translations:NVIDIA/23/en
All PRIME configurations require setting the PCI bus IDs of the two GPUs. One easy way to do find their IDs is by running lspci from the pciutils package, and then finding devices that are classified as VGA controllers. After double checking that the listed devices are indeed your integrated and dedicated GPUs, you can then find the PCI IDs at the beginning of each line. Exact results may vary, but an example output might look like:
$ nix shell nixpkgs#pciutils -c lspci -D -d ::03xx
0000:00:02.0 VGA compatible controller: Intel Corporation TigerLake-H GT1 [UHD Graphics] (rev 01)
0000:01:00.0 VGA compatible controller: NVIDIA Corporation GA106M [GeForce RTX 3060 Mobile / Max-Q] (rev a1)
Before putting them into your configuration, however, they must first be reformatted — assuming the bus address is <domain>:<bus>:<device>.<func>, convert all numbers from hexadecimal to decimal, then the formatted string is PCI:<bus>@<domain>:<device>:<func>. They can be set under intelBusId, nvidiaBusId, or amdgpuBusId in hardware.nvidia.prime, depending on the manufacturer of the GPU:
{
hardware.nvidia.prime = {
intelBusId = "PCI:0@0:2:0";
nvidiaBusId = "PCI:1@0:0:0";
# amdgpuBusId = "PCI:5@0:0:0"; # If you have an AMD iGPU
};
}