Configure Windows VM

This commit is contained in:
Agatha Lovelace 2024-11-22 17:31:21 +01:00
parent b108f84b8b
commit 6318113c76
Signed by: sorceress
GPG Key ID: 01D0B3AB10CED4F8
2 changed files with 41 additions and 2 deletions

39
common/fragments/virt.nix Normal file
View File

@ -0,0 +1,39 @@
{ pkgs, lib, ... }:
{
boot = {
initrd.kernelModules = [
"vfio_pci"
"vfio"
"vfio_iommu_type1"
"amdgpu"
];
kernelParams =
let
gpuIDs = [
"1002:67df" # Graphics
"1002:aaf0" # Audio
];
in
[
# enable IOMMU
"amd_iommu=on"
("vfio-pci.ids=" + lib.concatStringsSep "," gpuIDs)
];
};
hardware.opengl.enable = true;
virtualisation.spiceUSBRedirection.enable = true;
services.openssh.settings.X11Forwarding = true;
# Virtualization
virtualisation.libvirtd = {
enable = true;
onBoot = "start";
onShutdown = "shutdown";
};
programs.virt-manager.enable = true;
users.users.agatha.extraGroups = [ "libvirtd" ];
}

View File

@ -1,8 +1,8 @@
{ {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
../../common/fragments/graphical ../../common/fragments/graphical/barebones.nix
../../common/fragments/yubikey.nix ../../common/fragments/virt.nix
../../common/home_manager/common.nix ../../common/home_manager/common.nix
]; ];