2012-03-01 20:10:08 +00:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
|
|
|
|
2012-03-10 14:34:40 +00:00
|
|
|
let virtualbox = config.boot.kernelPackages.virtualbox; in
|
|
|
|
|
2012-03-01 20:10:08 +00:00
|
|
|
{
|
|
|
|
boot.kernelModules = [ "vboxdrv" "vboxnetadp" "vboxnetflt" ];
|
2012-03-10 14:34:40 +00:00
|
|
|
boot.extraModulePackages = [ virtualbox ];
|
|
|
|
environment.systemPackages = [ virtualbox ];
|
2012-03-01 20:10:08 +00:00
|
|
|
|
2012-03-20 16:30:43 +00:00
|
|
|
users.extraGroups = singleton { name = "vboxusers"; };
|
|
|
|
|
|
|
|
services.udev.extraRules =
|
|
|
|
''
|
|
|
|
KERNEL=="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"
|
|
|
|
KERNEL=="vboxnetctl", OWNER="root", GROUP="root", MODE="0600"
|
|
|
|
'';
|
2012-03-21 12:28:14 +00:00
|
|
|
|
|
|
|
# Since we lack the right setuid binaries, set up a host-only network by default.
|
|
|
|
|
|
|
|
jobs."create-vboxnet0" =
|
|
|
|
{ task = true;
|
|
|
|
path = [ virtualbox ];
|
|
|
|
startOn = "starting network-interfaces";
|
|
|
|
script =
|
|
|
|
''
|
|
|
|
if ! [ -e /sys/class/net/vboxnet0 ]; then
|
|
|
|
VBoxManage hostonlyif create
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2012-03-21 12:38:11 +00:00
|
|
|
networking.interfaces = [ { name = "vboxnet0"; ipAddress = "192.168.56.1"; subnetMask = "255.255.255.0"; } ];
|
2012-03-01 20:10:08 +00:00
|
|
|
}
|