Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NixOS: Setting the default channel in configuration.nix

Tags:

nix

nixos

How do I set the default channel in NixOS's /etc/configuration.nix?

There is a command to set it and rebuild with

sudo nix-channel --add https://nixos.org/channels/nixpkgs-unstable
sudo nixos-rebuild switch -I nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs

but I'd like to have it setup in configuration.nix so I don't have to remember how to do this everytime. Thanks!

like image 709
Jacob Wang Avatar asked Apr 06 '16 13:04

Jacob Wang


2 Answers

system.autoUpgrade.channel is what you might be looking for

set it to any channel e.g.

system.autoUpgrade.channel = "https://nixos.org/channels/nixos-16.03-small/";

the documentation says:

by default, this is the channel set using nix-channel (run nix-channel --list to see the current value)

an up to date list of channels can be found on https://nixos.org/channels/

ref: https://nixos.org/nixos/manual/options.html#opt-system.autoUpgrade.channel https://nixos.org/nixos/manual/index.html#idm140737317454064

like image 141
hash Avatar answered Nov 19 '22 12:11

hash


Set nixPath = [ "nixpkgs=http://nixos.org/channels/nixos-unstable/nixexprs.tar.xz" ];, see https://github.com/snabblab/snabblab-nixos/blob/d8b9761b107293891b19021f2f0f77a0e3ba3746/modules/common.nix#L39

like image 6
iElectric Avatar answered Nov 19 '22 13:11

iElectric