tweaking vm options

This commit is contained in:
serenity-F 2026-04-19 20:31:36 +10:00
parent fc8642a2d0
commit 5f287a35c1
No known key found for this signature in database
4 changed files with 48 additions and 36 deletions

View file

@ -12,6 +12,7 @@
# Host-specific core modules
../../../core/zfs.nix
../../../core/gaming.nix
../../../core/virtualisation.nix
];
# ooh, hostname - this one's important!

View file

@ -1,35 +0,0 @@
{ user, ... }:
let
# Name of the group needed to use VirtualBox
vboxgroup = "vmusers";
in {
# Permissions configuration
users = {
# Creates the group providing access to VirtualBox
extraGroups."${vboxgroup}".members = [ "user-with-access-to-virtualbox" ];
# Adds primary user to vboxusers group
users."${user}".extraGroups = [ "vboxusers" ];
};
# VirtualBox configuration
virtualisation.virtualbox = {
# Enables VirtualBox with this machine as the host
host.enable = true;
# Increases security when using VirtualBox
#host.enableHardening = true;
# Needed for USB2 and USB3 passthrough
host.enableExtensionPack = true;
};
}

47
core/virtualisation.nix Normal file
View file

@ -0,0 +1,47 @@
{ user, pkgs, ... }:
let
# Name of the group needed to use VirtualBox
vmgroup = "vmusers";
in {
# Permissions configuration
users = {
# Gives users virtualisation permissions
groups.kvm.members = [ "${user}" ];
groups.libvirtd.members = [ "${user}" ];
extraGroups."${vmgroup}".members = [ "${user}" ];
users."${user}".extraGroups = [ "${vmgroup}" ];
};
# Virtualisation packages
environment.systemPackages = with pkgs; [
gnome-boxes # VM frontend
dnsmasq # Vm networking
phodav # Fileshare with guest VMs
];
# Virtualisation configuration
virtualisation = {
# Base virtualisation set up
libvirtd.enable = true;
# TPM emulation for Win11
libvirtd.qemu = {
swtpm.enable = true;
ovmf.packages = [ pkgs.OVMFFull.fd ];
};
# Enables USB passthrough
spiceUSBRedirection.enable = true;
# VirtualBox configuration
virtualbox = {
# Enables VirtualBox with this machine as the host
#host.enable = false;
# Increases security when using VirtualBox
#host.enableHardening = true;
# Needed for USB2 and USB3 passthrough
#host.enableExtensionPack = true;
};
};
}

View file

@ -150,7 +150,6 @@ in {
# Desktop App Suite
gnome-calculator # Simple calculator
appimage-run # Runs appimages
gnome-boxes # Virtualisation host
file-roller # Simple archive manager
themix-gui # GTK theme creation tool
nautilus # Simple file manager