如何在NixOS的/etc/configuration.nix
中设置默认频道?
有一个命令来设置它并用它重建
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
但是我想在configuration.nix中设置它,所以我不必每次都记住如何做。谢谢!
system.autoUpgrade.channel
是您想要的]
将其设置为任何频道,例如
system.autoUpgrade.channel = "https://nixos.org/channels/nixos-16.03-small/";
文档说:
默认情况下,这是使用nix-channel设置的通道(运行
nix-channel --list
查看当前值)
可以在https://nixos.org/channels/上找到最新的频道列表>
ref:https://nixos.org/nixos/manual/options.html#opt-system.autoUpgrade.channelhttps://nixos.org/nixos/manual/index.html#idm140737317454064
设置nixPath = [ "nixpkgs=http://nixos.org/channels/nixos-unstable/nixexprs.tar.xz" ];
,请参阅https://github.com/snabblab/snabblab-nixos/blob/master/modules/common.nix#L37
nix.nixPath
(ref)选项看起来像您要执行的操作。