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

40 lines
1.1 KiB
Nix
Raw Permalink 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;
};
};
2023-11-10 13:53:46 +01:00
users.groups.vboxusers = {};
sisyphus.users.wantedGroups = [
config.users.groups.vboxusers.name # The group we defined earlier
config.users.groups.dialout.name # Serial Port
2023-10-18 16:47:13 +02:00
];
};
}