{
  config,
  lib,
  pkgs,
  ...
}:
with lib;
{

  options.components.virtualisation.virtualbox.enable = lib.mkOption {
    type = lib.types.bool;
    default = config.components.virtualisation.enable;
  };

  config = mkIf config.components.virtualisation.virtualbox.enable {

    virtualisation.virtualbox.host.enable = true;
    virtualisation.virtualbox.host.enableExtensionPack = true;
    virtualisation.virtualbox.guest.enable = true;
    virtualisation.virtualbox.guest.dragAndDrop = true;

    # https://discourse.nixos.org/t/issue-with-virtualbox-in-24-11/57607/2
    boot.kernelParams = [ "kvm.enable_virt_at_load=0" ];

    users.extraGroups.vboxusers.members = [ config.users.users.mainUser.name ];

  };

}