Install virtualbox in NixOS?

Just to be clear: I’m not trying to use virtualbox to install NixOS. I’m using NixOS (it’s the only OS on my laptop), and I would like to use virtualbox so that I can play with other distros.

I found VirtualBox - NixOS Wiki, and I’ve added this:

  # Enable virtualbox. Ref <https://nixos.wiki/wiki/Virtualbox>
  virtualisation.virtualbox.host.enable = true;
  users.extraGroups.vboxusers.members = [ "stian" ];

to my configuration.nix, and I’ve done sudo nixos-rebuild switch. I’ve also rebooted for good measure. My problem? It may be embarrassing: How do I start virtualbox? I can’t seem to figure out what the executable is called. I’m using i3 and I open programs using dmenu.

I must be running out of juice. Glad it’s almost the weekend :slight_smile:

Right after posting the above I found functor.tokyo -- Install VirtualBox on NixOS, which helped me solve the problem: dmenu cares about casing, I don’t. Writing “VirtualBox” in dmenu works, writing “virtualbox” does not. At least with my settings.

4 Likes

Actually, you can also find the command which pakcage will provide in search.nixos.org.

By the ways, could you run other distro or system currently?
I seems have some kinds of error like Kernel driver not accessible.

I’m having the same issue! Virtualbox is installed and I get this error:

VirtualBox kernel driver is not accessible, permission problem. If you have built VirtualBox yourself, make sure that you do not have the vboxdrv kernel module from a different build or installation loaded. Also, make sure the vboxdrv udev rule gives you the permission you need to access the device. (VERR_VM_DRIVER_NOT_ACCESSIBLE).

Here’s what config I use:

  # virtualization
  virtualisation.virtualbox.host.enable = true;
  virtualisation.virtualbox.guest.enable = true;
  virtualisation.virtualbox.guest.draganddrop = true;
  users.extraGroups.vboxusers.members = [ "melty" ];

I don’t think you want to enable host and guest in the same configuration. Enable guest in the configuration running inside virtualbox.

Interesting, because @dtannock it seems to work, even though it might be bad.

I mean…if something has the intended effect…then it works!

And, I got it to work! Here’s my config: