{ pkgs, lib, config, ... }: with lib; let cfg = config.global.virtualbox; in { options.global.virtualbox = { enable = mkEnableOption "virtualbox host (kvm)"; }; config = mkIf cfg.enable { virtualisation.virtualbox.host = { enable = true; enableKvm = true; enableExtensionPack = true; enableHardening = false; addNetworkInterface = false; }; # allow virtualbox USB passthrough users.adminGroups = [ "vboxusers" ]; users.home.persist.directories = [ ".config/VirtualBox" ]; users.homeModules = [ { wayland.windowManager.sway.config.window.commands = [ { criteria.class = "VirtualBox Manager"; command = "floating enable"; } ]; } ]; }; }