d9d6fb58e4
constantly by Upstart. Also move the module to a better location. svn path=/nixos/trunk/; revision=32565
50 lines
792 B
Nix
50 lines
792 B
Nix
# Module for VirtualBox guests.
|
|
|
|
{ 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 = [ kernel.virtualboxGuestAdditions ];
|
|
|
|
boot.extraModulePackages = [ kernel.virtualboxGuestAdditions ];
|
|
|
|
jobs.virtualbox =
|
|
{ description = "VirtualBox service";
|
|
|
|
startOn = "started udev";
|
|
|
|
exec = "${kernel.virtualboxGuestAdditions}/sbin/VBoxService --foreground";
|
|
};
|
|
|
|
};
|
|
|
|
}
|