vfio fuckery
Lint / lint (push) Successful in 26s
Details
Lint / lint (push) Successful in 26s
Details
based on https://astrid.tech/2022/09/22/0/nixos-gpu-vfio/
This commit is contained in:
parent
be3c76801e
commit
baa2417bfe
|
@ -4,8 +4,11 @@
|
|||
imports =
|
||||
[
|
||||
./hardware-configuration.nix
|
||||
./vfio.nix
|
||||
];
|
||||
|
||||
vfio.enable = true;
|
||||
|
||||
# Bootloader
|
||||
boot = {
|
||||
loader = {
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
let
|
||||
# RTX 3070 Ti
|
||||
gpuIDs = [
|
||||
"10de:1b81" # Graphics
|
||||
"10de:10f0" # Audio
|
||||
];
|
||||
in { pkgs, lib, config, ... }: {
|
||||
options.vfio.enable = with lib;
|
||||
mkEnableOption "Configure the machine for VFIO";
|
||||
|
||||
config = let cfg = config.vfio;
|
||||
in {
|
||||
boot = {
|
||||
initrd.kernelModules = [
|
||||
"vfio_pci"
|
||||
"vfio"
|
||||
"vfio_iommu_type1"
|
||||
|
||||
"nvidia"
|
||||
"nvidia_modeset"
|
||||
"nvidia_uvm"
|
||||
"nvidia_drm"
|
||||
];
|
||||
|
||||
kernelParams = [
|
||||
# enable IOMMU
|
||||
"amd_iommu=on"
|
||||
"pcie_acs_override=downstream,multifunction"
|
||||
] ++ lib.optional cfg.enable
|
||||
# isolate the GPU
|
||||
("vfio-pci.ids=" + lib.concatStringsSep "," gpuIDs);
|
||||
};
|
||||
|
||||
hardware.opengl.enable = true;
|
||||
virtualisation.spiceUSBRedirection.enable = true;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue