On the stable channel, I just did the following to get VBoxManage to work. It was not on the wiki, nor on any github issue:
environment.systemPackages = [ virtualboxHardened ];
services.virtualbox.host = { enable = true; enableHardening = false; };
security.setuidPrograms = [ "VirtualBox" "VBoxManage" ];
The setuidPrograms line is meant to allow non-root users to start virtualbox, and is set at install on recent channels (although VBoxManage doesn't seem to be in that package for some reason. This should be tested against a recent unstable).
I guess another way would be to install virtualBox, and set enableHardening = false, but this is really documented nowhere.
Another undocumented thing is that one needs both services.virtualbox.host.… set, and a package installed: the current wiki page makes it look like the services.virtualbox option is enough, but it wasn't in my case.
meanwhile https://nixos.org/wiki/Installing_VirtualBox_on_NixOS disappeared
The community-maintained NixOS wiki now can be found at https://nixos.wiki
I couldn't find "Installing VirtualBox on NixOS" instruction on https://nixos.wiki
But on github https://github.com/deepfire/nixos-wiki/blob/master/Installing%20VirtualBox%20on%20NixOS.page
setuidPrograms is obsolete
trace: warning: The option definitionsecurity.setuidPrograms' in /etc/nixos/configuration.nix' no longer has any effect
Shouldn't it be simply
virtualisation.virtualbox.host.enable = true;
users.extraUsers.myuser.extraGroups = ["vboxusers"];
as described in the options?
works fine on
18.03.132750.91b286c8935
Most helpful comment
Shouldn't it be simply
as described in the options?