Skip to content

Commit 029ee4a

Browse files
committed
system silvio-pc: enable vfio
1 parent 0113e4d commit 029ee4a

File tree

2 files changed

+39
-3
lines changed

2 files changed

+39
-3
lines changed

flake.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,17 @@
3838
rec {
3939
nixosConfigurations = let
4040
lib = (import ./system/lib.nix) {inherit nixpkgs;};
41+
nur-no-pkgs = import nur {
42+
nurpkgs = import nixpkgs {system = "x86_64-linux";};
43+
};
4144
in
4245
lib.mkHosts {
4346
modules = [
4447
inputs.disko.nixosModules.disko
4548
inputs.impermanence.nixosModules.impermanence
4649
inputs.sops-nix.nixosModules.sops
50+
nur-no-pkgs.repos.crtified.modules.vfio
51+
nur-no-pkgs.repos.crtified.modules.libvirt
4752
];
4853
machinedir = ./system/machines;
4954
};

system/machines/silvio-pc/virtualisation.nix

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,38 @@
44
libvirtUsers = ["silvio" "sa"];
55
};
66

7-
# Blacklist nvidia because it's annoying.
8-
# TODO: pcie passthrough using ie. https://github.com/CRTified/nur-packages
9-
boot.blacklistedKernelModules = ["nvidia" "nouveau"];
7+
virtualisation.vfio = {
8+
enable = true;
9+
IOMMUType = "intel";
10+
devices = [
11+
"10de:1380" # NVIDIA Corporation GM107 [GeForce GTX 750 Ti]
12+
"10de:0fbc" # NVIDIA Corporation GM107 High Definition Audio Controller [GeForce 940MX]
13+
];
14+
blacklistNvidia = true;
15+
applyACSpatch = false; # TODO fix upstream
16+
};
17+
18+
# workaround for dysfunctional option upstream
19+
boot.kernelParams = [
20+
"pcie_acs_override=downstream,multifunction"
21+
"pci=nomsi"
22+
];
23+
boot.kernelPatches = [
24+
{
25+
name = "add-acs-overrides";
26+
patch = pkgs.fetchurl {
27+
name = "add-acs-overrides.patch";
28+
url = "https://aur.archlinux.org/cgit/aur.git/plain/1001-6.6.7-add-acs-overrides.patch?h=linux-vfio&id=3d7255075f74ae27d4bddfc9c18f8e434e8255d3";
29+
sha256 = "sha256-80KYa9J5gMlslSsN2BA9PiGpQth/GN8TCPqzcOIAEPs=";
30+
};
31+
}
32+
{
33+
name = "i915-vga-arbiter";
34+
patch = pkgs.fetchurl {
35+
name = "i915-vga-arbiter.patch";
36+
url = "https://aur.archlinux.org/cgit/aur.git/plain/1002-6.6.7-i915-vga-arbiter.patch?h=linux-vfio&id=3d7255075f74ae27d4bddfc9c18f8e434e8255d3";
37+
sha256 = "sha256-KjxzLU1hpjHJiyo+Svsfpdv4vlxDUZsqWdDmUXDJ2Ns=";
38+
};
39+
}
40+
];
1041
}

0 commit comments

Comments
 (0)