From 5f287a35c12d5141252be4e9c74dcb2bc2e8129f Mon Sep 17 00:00:00 2001 From: serenity-F Date: Sun, 19 Apr 2026 20:31:36 +1000 Subject: [PATCH] tweaking vm options --- core/hosts/hades/default.nix | 1 + core/virtualbox.nix | 35 --------------------------- core/virtualisation.nix | 47 ++++++++++++++++++++++++++++++++++++ home/desktop/default.nix | 1 - 4 files changed, 48 insertions(+), 36 deletions(-) delete mode 100644 core/virtualbox.nix create mode 100644 core/virtualisation.nix diff --git a/core/hosts/hades/default.nix b/core/hosts/hades/default.nix index d8c0519..7a5a636 100755 --- a/core/hosts/hades/default.nix +++ b/core/hosts/hades/default.nix @@ -12,6 +12,7 @@ # Host-specific core modules ../../../core/zfs.nix ../../../core/gaming.nix + ../../../core/virtualisation.nix ]; # ooh, hostname - this one's important! diff --git a/core/virtualbox.nix b/core/virtualbox.nix deleted file mode 100644 index 240f07c..0000000 --- a/core/virtualbox.nix +++ /dev/null @@ -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; - - }; - -} diff --git a/core/virtualisation.nix b/core/virtualisation.nix new file mode 100644 index 0000000..1fdbfd7 --- /dev/null +++ b/core/virtualisation.nix @@ -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; + }; + }; +} diff --git a/home/desktop/default.nix b/home/desktop/default.nix index 2833d0e..b966bf2 100755 --- a/home/desktop/default.nix +++ b/home/desktop/default.nix @@ -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