From 8884d445b7f77e713ea413839641eb21248871ae Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 21 Mar 2012 12:28:14 +0000 Subject: [PATCH] * VirtualBox: create a vboxnet0 interface by default. svn path=/nixos/trunk/; revision=33331 --- modules/programs/virtualbox.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules/programs/virtualbox.nix b/modules/programs/virtualbox.nix index 34b2c1566326..60f58c922b96 100644 --- a/modules/programs/virtualbox.nix +++ b/modules/programs/virtualbox.nix @@ -16,4 +16,20 @@ let virtualbox = config.boot.kernelPackages.virtualbox; in KERNEL=="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660" KERNEL=="vboxnetctl", OWNER="root", GROUP="root", MODE="0600" ''; + + # 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 + ''; + }; + + networking.interfaces = [ { name = "vboxnet0"; ipAddress = "192.168.56.1"; } ]; }