Nvidia eGPU PRIME Sync Issues

Description

I am having some trouble with setting up PRIME sync with my Nvidia eGPU. It seems that the regex for the PCI bus id is not equipped to handle an alphanumeric ID (all examples show pci@0000:01:00.0 style IDs but mine is pci@0000:2d:00.0)

Setup

  • NixOS stable (23.05)

  • Framework 13 (i7-1260P)

  • Akitio Node Titan eGPU enclosure

  • Nvidia 1070ti GPU

Example from Nvidia - NixOS Wiki

*-display                 
description: i915drmfb
physical id: 0
bus info: pci@0000:01:00.0
logical name: /dev/fb0
version: a1
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list rom fb
configuration: depth=32 driver=nvidia latency=0 mode=2560x1600 visual=truecolor xres=2560 yres=1600
resources: iomemory:600-5ff iomemory:620-61f irq:220 memory:85000000-85ffffff memory:6000000000-61ffffffff memory:6200000000-6201ffffff ioport:5000(size=128) memory:86000000-8607ffff

*-display
product: i915drmfb
physical id: 2
bus info: pci@0000:00:02.0
logical name: /dev/fb0
version: 04
width: 64 bits
clock: 33MHz
capabilities: pciexpress msi pm bus_master cap_list rom fb
configuration: depth=32 driver=i915 latency=0 resolution=2560,1600
resources: iomemory:620-61f iomemory:400-3ff irq:221 memory:622e000000-622effffff memory:4000000000-400fffffff ioport:6000(size=64) memory:c0000-dffff memory:4010000000-4016ffffff memory:4020000000-40ffffffff

My output of lshw -c display

  *-display                 
       description: i915drmfb
       physical id: 2
       bus info: pci@0000:00:02.0
       logical name: /dev/fb0
       version: 0c
       width: 64 bits
       clock: 33MHz
       capabilities: pciexpress msi pm bus_master cap_list rom fb
       configuration: depth=32 driver=i915 latency=0 mode=2256x1504 visual=truecolor xres=2256 yres=1504
       resources: iomemory:600-5ff iomemory:400-3ff irq:128 memory:605c000000-605cffffff memory:4000000000-400fffffff ioport:3000(size=64) memory:c0000-dffff memory:4010000000-4016ffffff memory:4020000000-40ffffffff
  *-display UNCLAIMED
       physical id: 0
       bus info: pci@0000:2d:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress cap_list
       configuration: latency=0
       resources: iomemory:410-40f iomemory:410-40f memory:6e000000-6effffff memory:4100000000-410fffffff memory:4110000000-4111ffffff ioport:8000(size=128) memory:6f000000-6f07ffff

My Config

{ config, lib, pkgs, modulesPath, ... }:

{
  hardware.nvidia = {
    modesetting.enable = true;
    powerManagement.enable = false;
    powerManagement.finegrained = false;
    open = true;
    package = config.boot.kernelPackages.nvidiaPackages.stable;
    prime = {
      sync.enable = true;
      intelBusId  = "PCI:00:02:0";
      nvidiaBusId = "PCI:2d:00:0";
    };
  };
}

Error

building Nix...
building the system configuration...
error: A definition for option `hardware.nvidia.prime.nvidiaBusId' is not of type `string matching the pattern ([[:print:]]+[:@][0-9]{1,3}:[0-9]{1,2}:[0-9])?'. Definition values:
       - In `/etc/nixos/gpu.nix': "PCI:2d:00:0"

The Question

I am new to NixOS and how these configs are ingested. Can anyone point me to where I can edit the allowed regex to test a fix? Thanks in advance for any input!

Edit: formatting

In the PCI bus ID config you need to convert the hexadecimal numbers to decimal without padding, so in your case:

    prime = {
      sync.enable = true;
      intelBusId  = "PCI:0:2:0";
      nvidiaBusId = "PCI:45:0:0";
    };

Palm, meet forehead.

Thank you!

Could you help me learn where to find this in the source code for myself? I’d be grateful to know where to look so I can avoid asking possibly obvious questions like this in the future.

Haha, I’m happy to have helped, kept coming across your post on Google while trying to get this all working. I don’t think it was explicitly documented anywhere, I realised after reading this but you can see the regex, ([[:print:]]+[:@][0-9]{1,3}:[0-9]{1,2}:[0-9])? doesn’t match [a-f] anywhere.

I also updated the wiki page.

1 Like