nixpkgs/modules/services/misc/virtualbox.nix

50 lines
734 B
Nix
Raw Normal View History

# VirtualBox server
{ config, pkgs, ... }:
with pkgs.lib;
let
cfg = config.services.virtualbox;
kernel = config.boot.kernelPackages;
in
{
###### interface
options = {
services.virtualbox = {
enable = mkOption {
default = false;
description = "Whether to enable the VirtualBox service and other guest additions.";
};
};
};
###### implementation
config = mkIf cfg.enable {
environment.systemPackages = [ ];
boot.extraModulePackages = [ kernel.virtualboxGuestAdditions ];
jobs.virtualbox =
{ description = "VirtualBox service";
startOn = "started udev";
exec = "${kernel.virtualboxGuestAdditions}/sbin/VBoxService";
};
};
}