vfio reformatting and such

This commit is contained in:
Gerg-L 2024-06-08 13:04:48 -04:00
parent 6847448a39
commit a029177bde
Signed by: gerg-l
SSH key fingerprint: SHA256:FPYDHIkvMocr4wdmZXpgpJjsb2Tw6rASs2ISPbOb0KI
2 changed files with 79 additions and 85 deletions

View file

@ -46,12 +46,6 @@ in
'';
};
boot.kernelPatches = lib.singleton {
name = "fix_amd_mem_access";
patch = null;
extraStructuredConfig.HSA_AMD_SVM = lib.kernel.yes;
};
systemd.tmpfiles.rules = [
"L /etc/X11/xorg.conf.d/99-custom.conf - - - - /etc/Xorg/2_mon.conf"
@ -70,9 +64,27 @@ in
"vfio_iommu_type1.allow_unsafe_interrupts=1"
"kvm.ignore_msrs=1"
];
kernelPatches = lib.singleton {
name = "fix_amd_mem_access";
patch = null;
extraStructuredConfig.HSA_AMD_SVM = lib.kernel.yes;
};
virtualisation = {
libvirtd = {
};
environment = {
systemPackages = [
pkgs.dmidecode
cfg_monitors
];
shellAliases = {
vm-start = "virsh start Windows";
vm-stop = "virsh shutdown Windows";
};
};
programs.virt-manager.enable = true;
virtualisation.libvirtd = {
enable = true;
qemu = {
# Patch to disable hooking the mouse via evdev at VM startup
@ -107,22 +119,8 @@ in
namespaces = []
'';
};
};
};
environment = {
systemPackages = [
pkgs.dmidecode
cfg_monitors
];
shellAliases = {
vm-start = "virsh start Windows";
vm-stop = "virsh shutdown Windows";
};
};
programs.virt-manager.enable = true;
virtualisation.libvirtd.hooks.qemu = {
hooks.qemu = {
# Ordering is based on the name
"AAA" = lib.getExe (
pkgs.writeShellApplication {
name = "qemu-hook";
@ -139,9 +137,7 @@ in
if [ "$GUEST_NAME" != "Windows" ]; then
exit 0
fi
if [ "$OPERATION" == "prepare" ]; then
else if [ "$OPERATION" == "prepare" ]; then
# Stop display-manager
systemctl stop display-manager.service
@ -161,10 +157,7 @@ in
ln -fs /etc/Xorg/1_mon.conf /etc/X11/xorg.conf.d/99-custom.conf
touch /etc/Xorg/ONE_MONITOR
systemctl start display-manager.service
fi
if [ "$OPERATION" == "release" ]; then
else if [ "$OPERATION" == "release" ]; then
# Dual gpu/monitor stuff
systemctl stop display-manager.service
@ -186,12 +179,13 @@ in
# Restart display-manager
systemctl start display-manager.service
else
exit 0
fi
'';
}
);
};
};
inherit _file;
}

View file

@ -52,7 +52,7 @@
forceImportAll = true;
};
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
#disable hibernate and set cache max
#set ARC max
kernelParams = [ "zfs.zfs_arc_max=17179869184" ];
initrd = {
#module for multiple swap devices