Adding experimental i915 driver to NixOS for use as guest VM with SR-IOV passthrough

Howdy,

Background: I have a 12th gen Intel NUC I’m fiddling around with, running Proxmox. My goal is to pass through the iGPU to VMs running on the machine for the purposes of hardware-accelerated transcoding. I’ve actually achieved that goal - using this driver, installed on both the PVE host and an Ubuntu server guest: GitHub - strongtz/i915-sriov-dkms: dkms module of Linux i915 driver with SR-IOV support

Problem: I’d like to be able to run it on a NixOS guest instead of Ubuntu, though. The issue is that I’m so far from a NixOS expert that I’m not even sure where to start on using DKMS to add this as a kernel module.

My question: Is this something that’s difficult to adapt to NixOS configuration, or is it something that I can figure my way through? If so, where should I be looking to learn how to get it done?

Here’s an example of how a dkms module is Packard in NixOS: https://github.com/NixOS/nixpkgs/blob/fd531dee22c9a3d4336cc2da39e8dd905e8f3de4/pkgs/os-specific/linux/system76/defaullt.nix

What you then end up with is a bunch of kernel packages which are built with said module included. Ex. NixOS Search

To use such a kernel, set the NixOS option boot.kernelPackages.

1 Like

Thanks for your link! It lead to a 404 but I changed defaullt.nix to default.nix at the end of the URL and it led me to this:

Cheers!

Sorry to piggyback of this topic but did you get it to work? I’m looking to do something similar.

To be brutally honest, no.

I determined that this level of customisation is presently beyond my ability and ran Nix on Ubuntu instead so I could just use dkms.

The driver is experimental, though, and while I’ve gotten it working on the VM, none of the sub-iGPUs or even the root iGPU can be used on Proxmox itself, which I’m thinking would actually be more ideal (to use a Nixos LXC with direct access to /dev/dri). My fiddling is very, very far from production, even ignoring this snag.