Using the linux-vfio kernel on NixOS

I’m in the process of setting up GPU passthrough on NixOS, but my hardware requires me to use linux-vfio with which I request some help installing. On Arch Linux, this was available on the AUR, but I’m a bit lost on how to port it to NixOS.

Thinking I only needed add-acs-overrides.patch from the AUR page above, I blindly tried the following after searching how one would apply a patch.

  boot.kernelPackages = pkgs.linuxPackages_4_14;
  nixpkgs.config.packageOverrides = pkgs: {
    linux_4_14 = pkgs.linux_4_14.override {
      kernelPatches = pkgs.linux_4_14.kernelPatches ++ [
          name = "acs-overrides";
          patch = pkgs.fetchurl {
            url = "";
            sha256 = "abe269c6596b54a412bd8415472153f419026d4f367fa3ee1ebc8693ac66915d";

But I’m defenitely doing something wrong since it did not work.


I was going to fast: in the configuration I used when I created this thread I had added "pci_acs_override=downstream" to boot.kernelParams; I missed the ‘e’ in “pcie”, which explains why it didn’t seem like the patch was applied. Here is an updated, working configuration:

  boot.kernelParams = [ "pcie_acs_override=downstream" "intel_iommu=on" ];
  boot.kernelPatches = [ {
    name = "add-acs-overrides";
    patch = ./add-acs-overrides.patch;
  } ];

where add-acs-overrides.patch is a local copy of the patch.

1 Like