dotfiles
My PC Dotfiles & Websitegit clone https://github.com/maydayv7/dotfiles
commit 3e93c02d69336d400ab53ef54b7f059f16d88cc9 parent 170a7a687627bce893df5a316fdbbc1e6acd2afd Author: maydayv7 <maydayv7@gmail.com> Date: Mon, 21 Oct 2024 02:32:44 +0530 fix(VFIO): Syntax
Diffstat:
| M | README.md | | | 3 | +++ |
| M | modules/hardware/virtualisation/vfio.nix | | | 68 | ++++++++++++++++++++++++++++++++++++-------------------------------- |
2 files changed, 39 insertions(+), 32 deletions(-)
diff --git a/README.md b/README.md @@ -131,6 +131,7 @@ github:maydayv7/dotfiles ├───lib: utility library functions ├───nixosConfigurations │ ├───futura: NixOS configuration +│ ├───valkyrie: NixOS configuration │ └───vortex: NixOS configuration ├───overlays ├───packages @@ -503,9 +504,11 @@ You can navigate to the `README`s present in the various directories to know mor <summary><b>Changelog</b></summary> ### v24.1 + - GNOME Improvements - Use [PaperWM](https://github.com/paperwm/PaperWM) - Remove unneeded extensions +- Fix VFIO Configuration ### v24 diff --git a/modules/hardware/virtualisation/vfio.nix b/modules/hardware/virtualisation/vfio.nix @@ -4,7 +4,7 @@ ... }: let inherit (builtins) concatStringsSep elem; - inherit (lib) mkEnableOption mkForce mkIf mkOption optionals types; + inherit (lib) mkEnableOption mkForce mkIf mkMerge mkOption optionals types; enable = elem "virtualisation" config.hardware.support; cfg = config.hardware.vm; in { @@ -22,37 +22,41 @@ in { }; ## VFIO Configuration ## - config = mkIf (enable && cfg.vfio) { - specialisation.vfio.configuration.hardware = { - vm.vfio = true; - cpu.mode = mkForce "performance"; - }; - - system.nixos.tags = ["vfio"]; - boot = { - kernelParams = [ - "amd_iommu=pt" - "intel_iommu=pt" - "i915.enable_gvt=1" - "iommu=pt" - "kvm.ignore_msrs=1" - "kvm.report_ignored_msrs=0" - ("vfio-pci.ids=" + concatStringsSep "," cfg.passthrough) - ]; + config = mkMerge [ + (mkIf enable { + specialisation.vfio.configuration.hardware = { + vm.vfio = true; + cpu.mode = mkForce "performance"; + }; + }) - kernelModules = - [ - "vfio" - "vfio_pci" - "vfio_iommu_type1" - "vfio_virqfd" - ] - ++ optionals (elem "nvidia" config.services.xserver.videoDrivers) [ - "nvidia" - "nvidia_modeset" - "nvidia_uvm" - "nvidia_drm" + (mkIf (enable && cfg.vfio) { + system.nixos.tags = ["vfio"]; + boot = { + kernelParams = [ + "amd_iommu=pt" + "intel_iommu=pt" + "i915.enable_gvt=1" + "iommu=pt" + "kvm.ignore_msrs=1" + "kvm.report_ignored_msrs=0" + ("vfio-pci.ids=" + concatStringsSep "," cfg.passthrough) ]; - }; - }; + + kernelModules = + [ + "vfio" + "vfio_pci" + "vfio_iommu_type1" + "vfio_virqfd" + ] + ++ optionals (elem "nvidia" config.services.xserver.videoDrivers) [ + "nvidia" + "nvidia_modeset" + "nvidia_uvm" + "nvidia_drm" + ]; + }; + }) + ]; }