sisyphus/nixos/modules/virtualisation/virtualbox/default.nix

36 lines
976 B
Nix
Raw Normal View History

2023-10-18 16:47:13 +02:00
{ config, lib, pkgs, ... }:
let
cfg = config.sisyphus.virtualisation.virtualbox;
2023-11-02 17:35:40 +01:00
# I like to override the virtualbox package because it is frequently
# and rebuilds take quite long.
inherit (pkgs) fetchurl;
version = "7.0.10";
virtualbox-override = pkgs.virtualbox.overrideAttrs (oldAttrs: {
src = fetchurl {
url = "https://download.virtualbox.org/virtualbox/${version}/VirtualBox-${version}.tar.bz2";
sha256 = "0b1e6d8b7f87d017c7fae37f80586acff04f799ffc1d51e995954d6415dee371";
};
});
2023-10-18 16:47:13 +02:00
in {
options.sisyphus.virtualisation.virtualbox.enable = lib.mkEnableOption "VirtualBox";
config = lib.mkIf cfg.enable {
virtualisation.virtualbox = {
host = {
enable = true;
enableExtensionPack = true;
2023-11-02 17:35:40 +01:00
package = virtualbox-override;
2023-10-18 16:47:13 +02:00
};
guest = {
enable = true;
x11 = true;
};
};
users.extraGroups.vboxusers.members = [
"user-with-access-to-virtualbox"
];
};
}