feat(virtualbox): add kvm virtualbox host

This commit is contained in:
514fpv 2024-03-24 11:10:09 +08:00
parent 73d8353724
commit e2a68ae422
Signed by: koishi
SSH key fingerprint: SHA256:axz0uIzzY+5W19i7QOUuiw5LSqhKfCBKPf3L4xFRxLw

View file

@ -0,0 +1,34 @@
{ 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"; }
];
} ];
};
}