feat: Disable nvidia driver for dgpu passthrough
This commit is contained in:
parent
06b908a2e4
commit
bfef1951a3
4 changed files with 57 additions and 28 deletions
|
|
@ -10,7 +10,7 @@
|
||||||
(with inputs.nixos-hardware.nixosModules; [
|
(with inputs.nixos-hardware.nixosModules; [
|
||||||
common-hidpi
|
common-hidpi
|
||||||
common-cpu-intel
|
common-cpu-intel
|
||||||
common-gpu-nvidia
|
# common-gpu-nvidia
|
||||||
common-pc-laptop
|
common-pc-laptop
|
||||||
common-pc-laptop-ssd
|
common-pc-laptop-ssd
|
||||||
asus-battery
|
asus-battery
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
enableUdevRules = true;
|
enableUdevRules = true;
|
||||||
};
|
};
|
||||||
xserver.videoDrivers = ["nvidia"];
|
# xserver.videoDrivers = ["nvidia"];
|
||||||
};
|
};
|
||||||
nix = {
|
nix = {
|
||||||
settings = {
|
settings = {
|
||||||
|
|
@ -29,26 +29,50 @@
|
||||||
driver = "xe";
|
driver = "xe";
|
||||||
vaapiDriver = "intel-media-driver";
|
vaapiDriver = "intel-media-driver";
|
||||||
};
|
};
|
||||||
nvidia = {
|
# nvidia = {
|
||||||
# Fix Nvidia API Change, See <https://github.com/NixOS/nixpkgs/issues/467814/>
|
# # Fix Nvidia API Change, See <https://github.com/NixOS/nixpkgs/issues/467814/>
|
||||||
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
# package = config.boot.kernelPackages.nvidiaPackages.beta;
|
||||||
modesetting.enable = true;
|
# modesetting.enable = true;
|
||||||
open = true;
|
# open = true;
|
||||||
prime = {
|
# prime = {
|
||||||
reverseSync.enable = lib.mkDefault false;
|
# reverseSync.enable = lib.mkDefault false;
|
||||||
offload.enable = lib.mkDefault true;
|
# offload.enable = lib.mkDefault true;
|
||||||
intelBusId = "PCI:0:2:0";
|
# intelBusId = "PCI:0:2:0";
|
||||||
nvidiaBusId = "PCI:1:0:0";
|
# nvidiaBusId = "PCI:1:0:0";
|
||||||
};
|
# };
|
||||||
};
|
# };
|
||||||
};
|
};
|
||||||
boot = {
|
boot = {
|
||||||
extraModulePackages = with config.boot.kernelPackages; [ddcci-driver];
|
extraModulePackages = with config.boot.kernelPackages; [ddcci-driver];
|
||||||
|
kernelParams = [
|
||||||
|
"intel_iommu=on"
|
||||||
|
"iommu=pt"
|
||||||
|
];
|
||||||
kernelModules = [
|
kernelModules = [
|
||||||
"ddcci"
|
"ddcci"
|
||||||
"ddcci-backlight"
|
"ddcci-backlight"
|
||||||
"i2c-dev"
|
"i2c-dev"
|
||||||
|
"vfio-pci.ids=10de:2520,10de:228e"
|
||||||
];
|
];
|
||||||
|
initrd.kernelModules = [
|
||||||
|
"vfio_pci"
|
||||||
|
"vfio"
|
||||||
|
"vfio_iommu_type1"
|
||||||
|
];
|
||||||
|
blacklistedKernelModules = [
|
||||||
|
"nouveau"
|
||||||
|
"nvidia"
|
||||||
|
"nvidia_drm"
|
||||||
|
"nvidia_modeset"
|
||||||
|
"nvidia_uvm"
|
||||||
|
];
|
||||||
|
extraModprobeConfig = ''
|
||||||
|
options vfio-pci ids=10de:2520,10de:228e
|
||||||
|
softdep nvidia pre: vfio-pci
|
||||||
|
softdep nouveau pre: vfio-pci
|
||||||
|
softdep nvidia_drm pre: vfio-pci
|
||||||
|
softdep nvidia_modeset pre: vfio-pci
|
||||||
|
'';
|
||||||
binfmt = {
|
binfmt = {
|
||||||
emulatedSystems = [
|
emulatedSystems = [
|
||||||
"aarch64-linux"
|
"aarch64-linux"
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
{inputs, ...}: {
|
{inputs, ...}: {
|
||||||
config.specialisation.niri-dgpu = {
|
# config.specialisation.niri-dgpu = {
|
||||||
inheritParentConfig = true;
|
# inheritParentConfig = true;
|
||||||
configuration = {
|
# configuration = {
|
||||||
disabledModules = [
|
# disabledModules = [
|
||||||
inputs.nixos-hardware.nixosModules.common-gpu-nvidia
|
# inputs.nixos-hardware.nixosModules.common-gpu-nvidia
|
||||||
];
|
# ];
|
||||||
imports = [inputs.nixos-hardware.nixosModules.common-gpu-nvidia-nonprime];
|
# imports = [inputs.nixos-hardware.nixosModules.common-gpu-nvidia-nonprime];
|
||||||
hardware.nvidia.prime = {
|
# hardware.nvidia.prime = {
|
||||||
reverseSync.enable = true;
|
# reverseSync.enable = true;
|
||||||
offload.enable = false;
|
# offload.enable = false;
|
||||||
};
|
# };
|
||||||
};
|
# };
|
||||||
};
|
# };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,15 @@ in {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
users.groups.libvirtd.members = [cfg.unixName];
|
users.groups.libvirtd.members = [cfg.unixName];
|
||||||
|
users.groups.kvm.members = [cfg.unixName];
|
||||||
virtualisation = {
|
virtualisation = {
|
||||||
libvirtd = {
|
libvirtd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
qemu.vhostUserPackages = with pkgs; [virtiofsd];
|
qemu = {
|
||||||
|
runAsRoot = true;
|
||||||
|
swtpm.enable = true;
|
||||||
|
vhostUserPackages = with pkgs; [virtiofsd];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
spiceUSBRedirection = {
|
spiceUSBRedirection = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue