Install nixpkgs unstable in configuration.nix

Hey guys!

I am still learning how to use nixos. I am starting to get better and better but now I am wondering something … how do I configure nixos to install certain packages from nixpkgs unstable!

Thank you guys for your help!

1 Like

Hi Jeff, and welcome!

how do I configure nixos to install certain packages from nixpkgs unstable

The FAQ on the NixOS wiki answers this (permalink).

How can I install a package from unstable while remaining on the stable channel?

It is possible to have multiple nix-channels simultaneously. To add the unstable channel with the specifier unstable ,

sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos-unstable

After updating the channel

sudo nix-channel --update nixos-unstable

queries via nix-env (or nox ) will show packages from both stable and unstable . Use this to install unstable packages into your user environment. The following snippet shows how this can be done in configuration.nix .

{ config, pkgs, ... }:
let
  unstable = import <nixos-unstable> {};
in {
  environment.systemPackages = [ unstable.PACKAGE_NAME ];
}

If you want to install unfree packages from unstable you need to also set allowUnfree by replacing the import statment above with:

import <nixos-unstable> { config = { allowUnfree = true; }; }
6 Likes