How to Install VirtualBox on NixOS Latest

This tutorial will guide you through the process of installing VirtualBox on NixOS Latest using the official release from https://www.virtualbox.org/.

Prerequisites

Before we begin, make sure that you have the following:

Step 1: Install the Required Dependencies

To get started, you need to install some dependencies required by VirtualBox. Open your terminal and run the following command:

sudo nix-env -iA nixos.virtualbox-host-modules nixos.virtualbox-guest-modules

This command will install the virtualbox-host-modules and virtualbox-guest-modules packages.

Step 2: Add the VirtualBox Channel

Next, we need to add the VirtualBox channel to NixOS. Open your terminal and run the following command:

sudo nix-channel --add https://download.virtualbox.org/virtualbox/debian virtualbox

This command will add the VirtualBox channel to NixOS.

Step 3: Update Your System

Now that we have added the VirtualBox channel, we need to update our system to get the latest packages. Open your terminal and run the following command:

sudo nix-channel --update && sudo nix-env -iA nixos.virtualbox

This command will update the VirtualBox channel and install the latest version of VirtualBox.

Step 4: Enable VirtualBox Service

To enable VirtualBox service, open your terminal and run the following command:

sudo systemctl enable vboxdrv.service

This command will enable the vboxdrv.service to start VirtualBox automatically on boot.

Step 5: Test VirtualBox Installation

To test that VirtualBox is working correctly, open your terminal and run the following command:

VBoxManage --version

This command will display the version of VirtualBox you have installed.

Congratulations, you have successfully installed VirtualBox on NixOS Latest! You can now create virtual machines and start using them.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!