Channel names with `.` or `-` don't work with nix-env -iA attribute paths or don't work with nix-channel --remove #1457
Comments
This error also affects deletion of channels like But removal problem is caused by the |
This error is the same error as described here: #1067 |
To resolve this, channel names should not be allowed to have |
I marked this as stale due to inactivity. → More info |
You can work around this by quoting the attribute name: $ nix-channel --add https://nixos.org/channels/nixos-20.09-small nixos-20.09-small
$ nix-channel --list
nixos-20.09-small https://nixos.org/channels/nixos-20.09-small
$ nix-channel --update
$ nix-env -iA '"nixos-20.09-small".python3Packages.xdot'
installing 'python3.8-xdot-1.1'
... This works because channels are given their own attribute names. Similarly, you can create an attribute set with names with periods: $ nix repl
> { "attribute.with.dots" = 3; }
{ "attribute.with.dots" = 3; }
This doesn't appear to be the case anymore. $ nix-channel --remove "nixos-20.09-small"
$ nix-channel --list This is on nix-2.3.10. |
Actually, I just saw #1067, and this does still seem to be a bug. Despite $ ls -lah ~/.nix-defexpr/channels/
total 22M
dr-xr-xr-x 2 root root 4.0K Jan 1 1970 .
drwxrwxr-t 10117 root nixbld 22M Feb 16 09:35 ..
lrwxrwxrwx 1 root root 60 Jan 1 1970 manifest.nix -> /nix/store/xwxv7fylj1csazawsxznvfx0cfjbh6ng-env-manifest.nix
lrwxrwxrwx 1 root root 102 Jan 1 1970 nixos-20.09-small -> /nix/store/8s7yakyq8vxwbf1n2vs3wa075fb1dkmc-nixos-20.09-small-20.09.3152.08327493801/nixos-20.09-small Note that this doesn't happen if I don't have $ nix-channel --add https://nixos.org/channels/nixos-20.09-small nixos2009small
$ nix-channel --update
$ nix-channel --list
nixos2009small https://nixos.org/channels/nixos-20.09-small
$ nix-env -iA nixos2009small.python3Packages.xdot
installing 'python3.8-xdot-1.1'
...
$ nix-channel --remove nixos2009small
uninstalling 'nixos2009small-20.09.3152.08327493801'
building '/nix/store/c8z96qkdlkp9r8phgw4z6nd7bw8y0nnd-user-environment.drv'...
created 2 symlinks in user environment
$ nix-channel --list
$ ls -lah ~/.nix-defexpr/channels/
total 22M
dr-xr-xr-x 2 root root 4.0K Jan 1 1970 .
drwxrwxr-t 10117 root nixbld 22M Feb 16 09:35 ..
lrwxrwxrwx 1 root root 60 Jan 1 1970 manifest.nix -> /nix/store/xwxv7fylj1csazawsxznvfx0cfjbh6ng-env-manifest.nix |
When you create a channel with
.
or-
in its name like:nix-channel --add https://nixos.org/channels/nixos-17.03-small nixos-17.03-small
. And then you try to use it with an attribute path likenix-env -iA 'nixos-17.03-small.hello
, nix-env complains that it cannot find the attribute path. But if you instead give it a name likeA
, then it will work!This is happening on
1.11.15
.The text was updated successfully, but these errors were encountered: