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