The NixOS cheatsheet describes how to install packages from unstable
in configuration.nix
.
It starts off by saying to add the unstable channel
I was able to get this working with a suggestion by @EmmanuelRosa.
Here are the relevant parts of my /etc/nixos/configuration.nix
:
{ config, pkgs, ... }:
let
unstableTarball =
fetchTarball
https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz;
in
{
imports =
[ # Include the results of the hardware scan.
/etc/nixos/hardware-configuration.nix
];
nixpkgs.config = {
packageOverrides = pkgs: {
unstable = import unstableTarball {
config = config.nixpkgs.config;
};
};
};
...
};
This adds an unstable
derivative that can be used in environment.systemPackages
.
Here is an example of using it to install the htop
package from nixos-unstable:
environment.systemPackages = with pkgs; [
...
unstable.htop
];