Install VirtualBox Oracle Extension Pack on NixOS

2018-08-19

A couple months ago I posted an article about how to install VirtualBox on NixOS 18.03. I recently sent a PR fixing the situation with installing the VirtualBox Oracle Extension Pack. The instructions for using the Extension Pack will be slightly different for the next version of NixOS (which should be 18.09).

Enabling VirtualBox will be same. Here is an example /etc/nixos/configuration.nix:

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      /etc/nixos/hardware-configuration.nix
    ];

  # Enable virtualbox.
  virtualisation.virtualbox.host.enable = true;

  ...
}

Enabling the Extension Pack is also simple:

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      /etc/nixos/hardware-configuration.nix
    ];

  # Enable virtualbox.
  virtualisation.virtualbox.host.enable = true;

  # Enable the Oracle Extension Pack.
  virtualisation.virtualbox.host.enableExtensionPack = true;
  nixpkgs.config.allowUnfree = true;

  ...
}

Note that if you want to use the Oracle Extension Pack, you must set allowUnfree to true.

Unlike previous versions of NixOS, this should automatically download and install the Oracle Extension Pack for you. No manual downloading is required.

However, similar to previous versions of NixOS, VirtualBox will have to be rebuilt from scratch. This normally takes quite some time.

tags: nixos