pass nvidia gpu to vm
This commit is contained in:
@@ -6,9 +6,18 @@ in
|
|||||||
{
|
{
|
||||||
options.custom.hardware.vfio = {
|
options.custom.hardware.vfio = {
|
||||||
enable = mkEnableOption "Enables vfio";
|
enable = mkEnableOption "Enables vfio";
|
||||||
|
stub_pci = mkOption {
|
||||||
|
type = with lib.types; listOf str;
|
||||||
|
default = [ ];
|
||||||
|
description = "List of PCI devices to stub with vfio-pci";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf (cfg.enable && config.virtualisation.libvirtd.enable) {
|
config = mkIf (cfg.enable && config.virtualisation.libvirtd.enable) {
|
||||||
boot.kernelParams = [ "amd_iommu=on" "iommu=pt" ];
|
boot = {
|
||||||
|
kernelModules = [ "vfio" "vfio_iommu_type1" "vfio_pci" ];
|
||||||
|
kernelParams = [ "amd_iommu=on" "iommu=pt" ] ++ (if cfg.stub_pci != [] then [ "vfio-pci.ids=${concatStringsSep "," cfg.stub_pci}" ] else []);
|
||||||
|
blacklistedKernelModules = [ "nouveau" "nvidia" "nvidiafb" "nvidia-drm" "nvidia-uvm" "nvidia-modeset" ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
# Edit this configuration file to define what should be installed on
|
# 0000:2b:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM204 [GeForce GTX 970] [10de:13c2] (rev a1)
|
||||||
# your system. Help is available in the configuration.nix(5) man page, on
|
# 0000:2b:00.1 Audio device [0403]: NVIDIA Corporation GM204 High Definition Audio Controller [10de:0fbb] (rev a1)
|
||||||
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
|
||||||
|
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -25,9 +23,13 @@
|
|||||||
};
|
};
|
||||||
hardware = {
|
hardware = {
|
||||||
#amd-gpu.enable = true;
|
#amd-gpu.enable = true;
|
||||||
nvidia.enable = true;
|
nvidia.enable = false;
|
||||||
firmware.enable = true;
|
firmware.enable = true;
|
||||||
ssd.enable = true;
|
ssd.enable = true;
|
||||||
|
vfio = {
|
||||||
|
enable = true;
|
||||||
|
stub_pci = [ "10de:13c2" "10de:0fbb" ]; #nvidia
|
||||||
|
};
|
||||||
wooting.enable = true;
|
wooting.enable = true;
|
||||||
};
|
};
|
||||||
services = {
|
services = {
|
||||||
@@ -40,7 +42,7 @@
|
|||||||
};
|
};
|
||||||
graphical = {
|
graphical = {
|
||||||
audio.enable = true;
|
audio.enable = true;
|
||||||
sddm.enable = true;
|
#sddm.enable = true;
|
||||||
#nightlight.enable = true;
|
#nightlight.enable = true;
|
||||||
#i3.enable = true;
|
#i3.enable = true;
|
||||||
xfce.enable = true;
|
xfce.enable = true;
|
||||||
@@ -54,6 +56,7 @@
|
|||||||
};
|
};
|
||||||
mainUser.layout = "de";
|
mainUser.layout = "de";
|
||||||
mainUser.variant = "us";
|
mainUser.variant = "us";
|
||||||
|
services.xserver.displayManager.lightdm.enable = false; #no login manager!
|
||||||
|
|
||||||
nix.gc.automatic = lib.mkForce false;
|
nix.gc.automatic = lib.mkForce false;
|
||||||
networking = {
|
networking = {
|
||||||
|
|||||||
Reference in New Issue
Block a user