Channels: inconsistent channels / channel-list broken?

Here, nix-channel and nix-env seem to use different and inconsistent per-user channel-lists:

$ nix-channel --list
$ nix-env -iA nixos.abcde
warning: name collision in input Nix expressions, skipping '/home/user/.nix-defexpr/channels_root/nixos-2205'
suggestion: remove 'nixos-2205' from either the root channels or the user channels
warning: name collision in input Nix expressions, skipping '/home/user/.nix-defexpr/channels_root/nixos-2211'
suggestion: remove 'nixos-2211' from either the root channels or the user channels

$ ls -l .nix-defexpr/channels/
lrwxrwxrwx 1 root root 60 1970-01-01 01:00 manifest.nix -> /nix/store/x0px4rm8pi53gfvslwc02vmnfwdkvw0i-env-manifest.nix
lrwxrwxrwx 1 root root 71 1970-01-01 01:00 nixos-2205 -> /nix/store/czmb3rksbggr0xiiv77rvf9l7bw8652w-nixos-2205-22.05/nixos-2205
lrwxrwxrwx 1 root root 71 1970-01-01 01:00 nixos-2211 -> /nix/store/9vglhc9q3l7vm00j2297czxxcw122gbz-nixos-2211-22.11/nixos-2211
lrwxrwxrwx 1 root root 61 1970-01-01 01:00 unstable -> /nix/store/vdmjj61z974y21bix22msq6hcl258fnj-unstable/unstable
$ ls -l .nix-defexpr/channels_root/
total 20
lrwxrwxrwx 1 root root 60 1970-01-01 01:00 manifest.nix -> /nix/store/fgdmwwy9b44zxjx3p4khi9p3c1g5jx38-env-manifest.nix
lrwxrwxrwx 1 root root 61 1970-01-01 01:00 nixos -> /nix/store/93spqpz4436204ci3dfswl7h7xhrd6di-nixos-23.11/nixos
lrwxrwxrwx 1 root root 71 1970-01-01 01:00 nixos-2205 -> /nix/store/czmb3rksbggr0xiiv77rvf9l7bw8652w-nixos-2205-22.05/nixos-2205
lrwxrwxrwx 1 root root 71 1970-01-01 01:00 nixos-2211 -> /nix/store/9vglhc9q3l7vm00j2297czxxcw122gbz-nixos-2211-22.11/nixos-2211
lrwxrwxrwx 1 root root 71 1970-01-01 01:00 nixos-2305 -> /nix/store/7m0yda7a29bk2nsbvqzg5an2g1ldasdx-nixos-2305-23.05/nixos-2305

Is there any way to solve this, e.g. completely reset the channel-lists? I thought about manually deleting channels from .nix-defexpr/channels, but this seems wrong and would require manually modifying the nix-store…

For details, see also:
https://github.com/NixOS/nix/issues/9706
https://github.com/NixOS/nix/issues/9707

Hm, odd, wonder how you ended up like this, have you tried nix-channel --update, or re-adding the channels and removing them, for argument’s sake?

There’s documentation on the files nix-channel uses in the manual. Looks like the directories you’re seeing are backed by a profile, so you should be able to remove them with some nix-env invocation if re-adding and removing doesn’t work.

Also, just to be sure, have you tried sudo nix-channel --list? I wonder if that warning is just referring to your root channels.