2010-09-07 15:28:17 +02:00
|
|
|
# VirtualBox server
|
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.virtualbox;
|
2011-09-19 15:20:09 +02:00
|
|
|
kernel = config.boot.kernelPackages;
|
2010-09-07 15:28:17 +02:00
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-09-07 15:28:17 +02:00
|
|
|
options = {
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-09-07 15:28:17 +02:00
|
|
|
services.virtualbox = {
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-09-07 15:28:17 +02:00
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "Whether to enable the VirtualBox service and other guest additions.";
|
2011-09-14 20:20:50 +02:00
|
|
|
};
|
2010-09-07 15:28:17 +02:00
|
|
|
|
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-09-07 15:28:17 +02:00
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-09-07 15:28:17 +02:00
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
environment.systemPackages = [ ];
|
2011-08-09 21:53:01 +02:00
|
|
|
|
2011-09-19 15:20:09 +02:00
|
|
|
boot.extraModulePackages = [ kernel.virtualboxGuestAdditions ];
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-09-07 15:28:17 +02:00
|
|
|
jobs.virtualbox =
|
|
|
|
{ description = "VirtualBox service";
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-09-07 15:28:17 +02:00
|
|
|
startOn = "started udev";
|
|
|
|
|
2011-09-19 15:20:09 +02:00
|
|
|
exec = "${kernel.virtualboxGuestAdditions}/sbin/VBoxService";
|
2010-09-07 15:28:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|