From 233e4fe6a85f38a9db926259dd083fd22c794782 Mon Sep 17 00:00:00 2001 From: blahai Date: Fri, 22 Nov 2024 21:51:14 +0200 Subject: [PATCH] Global: add IOMMU toggle to virualisation --- modules/nixos/virtualisation.nix | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/nixos/virtualisation.nix b/modules/nixos/virtualisation.nix index 4b81237..6531d55 100644 --- a/modules/nixos/virtualisation.nix +++ b/modules/nixos/virtualisation.nix @@ -1,10 +1,12 @@ -{ pkgs, lib, config, ... }: { - boot = { - initrd.kernelModules = lib.mkBefore [ - "kvm-amd" - "vfio_pci" - "vfio_iommu_type1" - "vfio" +{ pkgs, lib, config, ... }: +let enableIOMMU = true; +in { + boot = lib.mkIf enableIOMMU { + initrd.kernelModules = lib.mkBefore [ + "kvm-amd" + "vfio_pci" + "vfio_iommu_type1" + "vfio" ]; kernelParams = [ "amd_iommu=on" @@ -49,5 +51,4 @@ moonlight-qt # for linux vms looking-glass-client # for windows vms :husk: ]; - }