Fix the dependencies of the vboxnet0 service
This commit is contained in:
parent
f3def8194e
commit
e02b57df9b
|
@ -10,25 +10,32 @@ let virtualbox = config.boot.kernelPackages.virtualbox; in
|
||||||
environment.systemPackages = [ virtualbox ];
|
environment.systemPackages = [ virtualbox ];
|
||||||
|
|
||||||
users.extraGroups = singleton { name = "vboxusers"; };
|
users.extraGroups = singleton { name = "vboxusers"; };
|
||||||
|
|
||||||
services.udev.extraRules =
|
services.udev.extraRules =
|
||||||
''
|
''
|
||||||
KERNEL=="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"
|
KERNEL=="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660", TAG+="systemd"
|
||||||
KERNEL=="vboxnetctl", OWNER="root", GROUP="root", MODE="0600"
|
KERNEL=="vboxnetctl", OWNER="root", GROUP="root", MODE="0600", TAG+="systemd"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Since we lack the right setuid binaries, set up a host-only network by default.
|
# Since we lack the right setuid binaries, set up a host-only network by default.
|
||||||
|
|
||||||
jobs."create-vboxnet0" =
|
jobs."vboxnet0" =
|
||||||
{ task = true;
|
{ description = "VirtualBox vboxnet0 Interface";
|
||||||
|
requires = [ "dev-vboxnetctl.device" ];
|
||||||
|
after = [ "dev-vboxnetctl.device" ];
|
||||||
|
before = [ "network-interfaces.service" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
path = [ virtualbox ];
|
path = [ virtualbox ];
|
||||||
startOn = "starting network-interfaces";
|
preStart =
|
||||||
script =
|
|
||||||
''
|
''
|
||||||
if ! [ -e /sys/class/net/vboxnet0 ]; then
|
if ! [ -e /sys/class/net/vboxnet0 ]; then
|
||||||
VBoxManage hostonlyif create
|
VBoxManage hostonlyif create
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
postStop =
|
||||||
|
''
|
||||||
|
VBoxManage hostonlyif remove vboxnet0
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.interfaces = [ { name = "vboxnet0"; ipAddress = "192.168.56.1"; subnetMask = "255.255.255.0"; } ];
|
networking.interfaces = [ { name = "vboxnet0"; ipAddress = "192.168.56.1"; subnetMask = "255.255.255.0"; } ];
|
||||||
|
|
Loading…
Reference in New Issue