Trying to remove nixos unstable channels, it doesnt work

image
so im trying to remove the nix channels as im troubleshooting errors when i rebuild the nixos config, how can i do this? i have tried doing the exact links yet it doesnt work.

You named the two channels nixos and nixpkgs. So those names should be used for removals…

Or you could just edit the file. I suspect the command doesn’t even do anything else.

doing this now causes this error when rebuilding the config

warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
error:
       … <borked>

         at «none»:0: (source not available)

       … while calling the 'import' builtin

         at «string»:1:6:

            1| with import <nixpkgs/nixos> {}; config.system.build.nixos-rebuild
             |      ^

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
building Nix...
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 «none»:0: (source not available)
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
error: file 'nixpkgs/nixos/modules/installer/tools/nix-fallback-paths.nix' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
/tmp/nixos-rebuild.pQgQJw/nix
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
building the system configuration...
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 «none»:0: (source not available)

Yes… you deleted the channel. I thought that was what you wanted.

ok i mean yeah, but i added some others back and now it wont work, ill prob get this error somewhere else, thanks anyways, it worked perfectly

On a NixOS, the set up is the way that whatever channel is named “nixos” is what’s used as the default expression. So you could add another channel with arbitrary URL under that name nixos, for example. (on non-NixOS it’s “nixpkgs”; that’s all from my older memory, hopefully still correct and not outdated or confused)

Do not forget to run nix-channel --update after adding channels to make them actually available (see the note in the description of --add).

1 Like

same exact error happens :confused:

nixos-rebuild uses the channels of the root user so you need to run all the nix-channel commands with sudo.

yup, this worked, sorry for the late answer though lmao.