On a NixOS host running incus I’ve managed to do GPU passthrough to a Ubuntu 26.04 guest. I’m trying to do the same with a NixOS guest (when the Ubuntu instance is down) without luck. I figured it’s a guest only problem as I managed to get it working with the Ubuntu guest. Anyone did this and if so, what changes did they apply to the NixOS guest to make it work? Trying KDE plasma on wayland atm but might try another window manager if that doesn’t work out.
I got this to work eventually. This case was for Intel Core Ultra 2 GPU. It was a combination of having
a properly configured host (that could launch a ubuntu 24.04 guest which only required proper intel drivers installed on the guest). Vague, but this post mostly concerns configuring a NixOS guest.
Using a proper guest configuration. I’ll show this here for anyone struggling with the same thing (note, there may be instructions here that doesn’t really matter and I’m only showing desktop essential ones):
{ modulesPath, pkgs, ... }:
{
imports = [
# Include the default incus configuration.
"${modulesPath}/virtualisation/incus-virtual-machine.nix"
# Include the container-specific autogenerated configuration.
./incus.nix
];
services.displayManager.gdm.enable = true;
services.desktopManager.gnome.enable = true;
# To disable installing GNOME's suite of applications
# and only be left with GNOME shell.
services.gnome.core-apps.enable = false;
services.gnome.core-developer-tools.enable = false;
services.gnome.games.enable = false;
environment.gnome.excludePackages = with pkgs; [ gnome-tour gnome-user-docs ];
services.xserver.xkb = {
layout = "se";
variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Install firefox.
programs.firefox.enable = true;
# hardware graphics extra packages
hardware.graphics = {
enable = true;
extraPackages = with pkgs; [
vpl-gpu-rt
intel-media-driver
# intel-compute-runtime
];
};
environment.sessionVariables = { LIBVA_DRIVER_NAME = "iHD"; };
nixpkgs.config.allowUnfree = true;
hardware.enableRedistributableFirmware = true;
# Force the inclusion of the Intel firmware package
hardware.firmware = [ pkgs.linux-firmware ];
# Load the i915 kernel module during the initial ramdisk (initrd) phase
boot.initrd.kernelModules = [ "i915" ];
boot.kernelPackages = pkgs.linuxPackages_latest;
system.stateVersion = "25.11"; # Did you read the comment?
}