NixOS-Config/hosts/tower/boot/default.nix

37 lines
882 B
Nix
Raw Normal View History

2024-11-05 05:49:14 -05:00
{ config, pkgs, ... }:
let
commonKernelParams = [
# VM/GPU passthrough
"amd_iommu=on"
"iommu=pt"
"nested=1"
# Virtualization nonsense
"transparent_hugepage=never"
# Isolate devices into IOMMU groups
"pcie_acs_override=downstream,multifunction"
"pci=routeirq"
];
in {
boot = {
# Must be Zen for IOMMU isolation
kernelPackages = pkgs.unstable.linuxPackages_zen;
kernel.sysctl."vm.max_map_count" = 2147483642;
kernelParams = commonKernelParams ++ [ "vfio-pci.ids=10de:1f82,10de:10fa" ];
2024-11-06 11:49:40 -05:00
blacklistedKernelModules = [ "pcspkr" ];
2024-11-24 09:55:02 -05:00
# Needed for GPU passthrough
initrd.kernelModules = [
"vfio"
"vfio_pci"
"vfio_iommu_type1"
];
};
# Use second GPU on boot
2024-11-06 11:49:40 -05:00
specialisation.gputwo.configuration = {
boot.kernelParams = commonKernelParams ++ [ "vfio-pci.ids=10de:2504,10de:228e" ];
};
}