work and nonwork

Enabling Unfree Packages on NixOS

September 08, 2019

Similar to Linux distributions such as Debian and Ubuntu, it is necessary on NixOS to opt-in to the use of unfree (free as in beer, but not “libre”) software before said software can be installed via the package manager. As this opt-in is not currently part of the OS install process, the user must make a few configuration changes after installing the OS to have access to non-libre software such as Slack and Spotify.

To allow users to install unfree packages into the user environment using the nix-env command, allowUnfree = true; must be added to ~/.config/nixpkgs/config.nix as it is below.

$ cd ~/.config/nixpkgs
$ cat config.nix

{
  # Enable searching for and installing unfree packages
  allowUnfree = true;
}

To allow for unfree packages to be installed into the global environment (for example by appending them to /etc/nixos/configuration.nix) a user with root privileges must add the following to /etc/nixos/configuration.nix:

# Enable unfree packages
nixpkgs.config.allowUnfree = true;

Chris Schappert

I'm Chris Schappert, a software developer living and working in Tokyo. Follow me on GitHub and LinkedIn.