nixos-rebuild构建失败,原因是缺少nixos通道



我想试试换频道。我做到了。

nix-channel --add .../nixos-unstable
nix-channel --remove  .../nixos-20.09
nix-channel --update

它工作了,它创建了一个链接,我可以运行:

nixos-rebuild switch

然而,我的i3停止正常工作,所以我想回到20.09:

nix-channel --add .../nixos-20.09
nix-channel --remove  .../nixos-unstable
nix-channel --update

但是现在它不重新创建链接,当运行

nixos-rebuild switch

失败
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:13
building Nix...

我已经搜索并尝试了一些适用于其他人的解决方案,如重新启动,使用sudo -i运行t,但到目前为止没有任何效果。如何重新创建该链接?

我找到了一个方法:我用不同的名称添加了通道,而不是默认的nixos-10.09,只是nixos

nix-channel --add ..../nixos-20.09 nixos
nix-channel --remove nixos-20.09 
nix-channel --update 

,瞧,链接被创建了,一切又正常了!

最新更新