Broadcom and Nvidia

Good afternoon / Evening / Night depending where you are from.

I will start by saying I am a NixOS noob. I have used Arch for many years and am making the switch to Nix slowly. I have the base system installed and Hyprland running on that with waybar wofi etc.

I have 2 things that are holding me back from going into Nix head on and customizing it to the way I want, installing apps / games etc

The 2 things are

1.Broadcom WiFi - I am using my laptop which has broadcom WiFi installed and it does not work OOB with Nix and cannot find any real recent information about how to install broadcom-wl within Nix

2. My laptop has hybrid graphics Intel UHD630 and an Nvidia GTX 1650 so I would like to get prime offload working so I can use the intel GPU for basic tasks and the Nvidia for more heavy tasks like gaming.

I am using the latest nixos iso available at the time of writing 25.11 on kernel 6.18.

Further information can be provided if required.

00:00.0 Host bridge: Intel Corporation 8th/9th Gen Core Processor Host Bridge / DRAM Registers (rev 07)
00:01.0 PCI bridge: Intel Corporation 6th-10th Gen Core Processor PCIe Controller (x16) (rev 07)
00:02.0 VGA compatible controller: Intel Corporation CoffeeLake-H GT2 [UHD Graphics 630]
00:12.0 Signal processing controller: Intel Corporation Cannon Lake PCH Thermal Controller (rev 10)
00:14.0 USB controller: Intel Corporation Cannon Lake PCH USB 3.1 xHCI Host Controller (rev 10)
00:14.2 RAM memory: Intel Corporation Cannon Lake PCH Shared SRAM (rev 10)
00:15.0 Serial bus controller: Intel Corporation Cannon Lake PCH Serial IO I2C Controller #0 (rev 10)
00:16.0 Communication controller: Intel Corporation Cannon Lake PCH HECI Controller (rev 10)
00:17.0 SATA controller: Intel Corporation Cannon Lake Mobile PCH SATA AHCI Controller (rev 10)
00:1d.0 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #9 (rev f0)
00:1d.5 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #14 (rev f0)
00:1d.6 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #15 (rev f0)
00:1f.0 ISA bridge: Intel Corporation HM370 Chipset LPC/eSPI Controller (rev 10)
00:1f.3 Audio device: Intel Corporation Cannon Lake PCH cAVS (rev 10)
00:1f.4 SMBus: Intel Corporation Cannon Lake PCH SMBus Controller (rev 10)
00:1f.5 Serial bus controller: Intel Corporation Cannon Lake PCH SPI Controller (rev 10)
01:00.0 VGA compatible controller: NVIDIA Corporation TU117M [GeForce GTX 1650 Mobile / Max-Q] (rev a1)
01:00.1 Audio device: NVIDIA Corporation Device 10fa (rev a1)
06:00.0 Non-Volatile memory controller: ADATA Technology Co., Ltd. XPG SX8200 Pro PCIe Gen3x4 M.2 2280 Solid State Drive (rev 03)
07:00.0 Network controller: Broadcom Inc. and subsidiaries BCM4360 802.11ac Dual Band Wireless Network Adapter (rev 03)
08:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTL8411B PCI Express Card Reader (rev 01)
08:00.1 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet Controller (rev 12)

Regarding the gpu offloading, have you already tried this from the wiki? https://wiki.nixos.org/wiki/NVIDIA#Hybrid_graphics_with_PRIME

I have never used it on my own, but I remember that there was some information in this article.

And you might want to have a look at this: https://discourse.nixos.org/t/broadcom-bcm43142-wifi-issues/51557/5

Sadly, the wiki instructions will not work on hyprland (or any wayland compositor), I just finished writing up a rant on how broken the nvidia module is: Can we solve the nvidia situation?

You want something like this, with wlroots:

Coupled with these udev rules:

… but yeah, it’s a bit of a mess.

1 Like

Are you perchance using the closed modules? Share your nvidia config; that should not be working. The current nvidia driver is incompatible with the 6.18 kernel, and you should never use linux_latest with nvidia - see the rant I linked above for details.

1 Like

The driver update merged yesterday is compatible with Linux 6.18, but of course hasn’t yet landed in unstable or 25.11 (but it’s in master and release-25.11)

2 Likes

I think last night I got the nvidia side of things working as I can now run nvidia-smi and get a result and it shows a few entries.

+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 580.105.08             Driver Version: 580.105.08     CUDA Version: 13.0     |
+-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce GTX 1650        Off |   00000000:01:00.0 Off |                  N/A |
| N/A   36C    P8              7W /   50W |      54MiB /   4096MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A            1354      G   ...urrent-system/sw/bin/Hyprland          2MiB |
|    0   N/A  N/A            2058    C+G   ./steamwebhelper                         43MiB |
|    0   N/A  N/A            2118    C+G   ...am/ubuntu12_64/steamwebhelper          4MiB |
+-----------------------------------------------------------------------------------------+

I am yet to install a game and test performance but i believe this means I have the drivers installed.

This is what I have in my configuration.nix

  # Enable OpenGL
  hardware.graphics = {
    enable = true;
  };

  services.xserver.videoDrivers = ["nvidia"];

  	hardware.nvidia.prime = {
        offload = {
            enable = true;
            enableOffloadCmd = true;
            };
		    intelBusId = "PCI:0:2:0";
		    nvidiaBusId = "PCI:1:0:0";
	};

  hardware.nvidia = {

    modesetting.enable = true;

    powerManagement.enable = false;

    powerManagement.finegrained = false;

    open = true;

    nvidiaSettings = true;

    package = config.boot.kernelPackages.nvidiaPackages.stable;
  };

Yes, but it also shows hyprland, which means that everything is rendering on your GPU. You’re not using PRIME, which is unsurprising; The prime module is broken on wayland. You’re unlucky that your dGPU happens to be the boot vga, otherwise offload would work out of the box.

This is fine if you don’t mind the battery usage, but if you want to use PRIME I imagine that’s a problem for you.

If not using PRIME works for you, I suggest simplifying your configuration to just this:

{ pkgs, lib, ... }: {
  services.xserver.videoDrivers = [ "nvidia" ];

  hardware.nvidia = {
    # If you don't enable this you'll have
    # issues with sleep
    powerManagement.enable = true;
    open = true;
  };

  # You don't need this if you don't override
  # your kernel version separately, but this
  # prevents mistakes.
  boot.kernelPackages = lib.mkForce pkgs.linuxKernel.packages.linux_default;
}

Everything else is superfluous, and force setting it prevents upstream maintenance; lots of people set those values but that’s because they see other people using them on the internet, not because it makes sense.

I explain this in my rant, too :wink:

1 Like