Adding unstable channel in configuration.nix

I want to add the unstable channel in configuration.nix so that i don’t have to add it via the terminal.

I found this possibility and it seems to work.

However, i still don’t really understand Nixos and would like to know, if this is correct and a good idea.

I also noticed, that the current installation instructions for home-manager prescribe

  home-manager = **builtins**.fetchTarball
    "https://github.com/nix-community/home-manager/archive/master.tar.gz";

whereas

 unstableTarball = fetchTarball
    "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz";

hasn’t got the builtins option. Is this important? What’s the difference?

Well, it’s even less reproducible than channels, since you don’t even control when it updates. However if that’s ok with you, there’s nothing really wrong with it other than that.

The more proper way to do this is to pin the commit of nixpkgs in your code and update it yourself along with the hash. There are various systems for automating this, including flakes.

There is no difference. Certain builtins are accessible directly, rather than going through the builtins attrset, but they’re the same functions either way.

1 Like

Could you please elaborate on how to keep the unstable channel as up to date as reasonable? What is the easiest way to achieve this?

The easiest way to do it is what you linked above, but it’s inherently non-reproducible. You have to decide how important that is to you.

If you decide you want some form of reproducible pinning, look into the documentation for flakes, or maybe nvfetcher or niv.

1 Like

I see, thank you for your help!

Reproducibility is not an issue for me, so i’ll leave it as is.