Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Channel names with . or - don't work with nix-env -iA attribute paths or don't work with nix-channel --remove #1457

Open
CMCDragonkai opened this issue Jul 11, 2017 · 7 comments
Assignees
Labels
cli The old and/or new command line interface stale UX The way in which users interact with Nix. Higher level than UI.

Comments

@CMCDragonkai
Copy link
Member

CMCDragonkai commented Jul 11, 2017

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 like nix-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 like A, then it will work!

This is happening on 1.11.15.

@CMCDragonkai CMCDragonkai changed the title Attribute path no longer working if using NIX_PATH environment instead of channels Channel names with - don't work with attribute paths. Oct 25, 2017
@CMCDragonkai CMCDragonkai changed the title Channel names with - don't work with attribute paths. Channel names with - don't work with nix-env -iA attribute paths. Oct 25, 2017
@CMCDragonkai
Copy link
Member Author

CMCDragonkai commented Oct 25, 2017

This error also affects deletion of channels like nix-channel --remove nixos-17.03-small will just not work.

But removal problem is caused by the - character as well.

@CMCDragonkai
Copy link
Member Author

This error is the same error as described here: #1067

@CMCDragonkai CMCDragonkai changed the title Channel names with - don't work with nix-env -iA attribute paths. Channel names with . don't work with nix-env -iA attribute paths. Oct 25, 2017
@CMCDragonkai
Copy link
Member Author

CMCDragonkai commented Oct 25, 2017

To resolve this, channel names should not be allowed to have ., while nix-channel needs to be fixed to allow - in their names.

@CMCDragonkai CMCDragonkai changed the title Channel names with . don't work with nix-env -iA attribute paths. Channel names with . or - don't work with nix-env -iA attribute paths or don't work with nix-channel --remove Oct 25, 2017
@shlevy shlevy added the backlog label Apr 1, 2018
@stale
Copy link

stale bot commented Feb 15, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Feb 15, 2021
@cdepillabout
Copy link
Member

cdepillabout commented Feb 16, 2021

you try to use it with an attribute path like nix-env -iA 'nixos-17.03-small.hello, nix-env complains that it cannot find the attribute path

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 error also affects deletion of channels like nix-channel --remove nixos-17.03-small will just not work.

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.

@stale stale bot removed the stale label Feb 16, 2021
@cdepillabout
Copy link
Member

cdepillabout commented Feb 16, 2021

This error also affects deletion of channels like nix-channel --remove nixos-17.03-small will just not work.
This doesn't appear to be the case anymore.

Actually, I just saw #1067, and this does still seem to be a bug.

Despite nix-channel --remove working correctly, the channel is still leftover in ~/.nix-defexpr/channels/:

$ 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 . in the channel name:

$ 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

@stale
Copy link

stale bot commented Aug 17, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Aug 17, 2021
@fricklerhandwerk fricklerhandwerk added cli The old and/or new command line interface UX The way in which users interact with Nix. Higher level than UI. labels Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli The old and/or new command line interface stale UX The way in which users interact with Nix. Higher level than UI.
Projects
None yet
Development

No branches or pull requests

6 participants