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

Slashes in the name of an attribute result in a parse error, and should be put in quotes #178

Closed
thoughtpolice opened this issue Aug 1, 2023 · 2 comments · Fixed by #179

Comments

@thoughtpolice
Copy link

Consider the following example (which I'm afraid I can't release the code to), where I want to update an attribute under the name psql_15/exts/pg_hashids — traceback and some fluff omitted:

$ nix-update --flake --version=branch psql_15/exts/pg_hashids

...
error: undefined variable 'or'

       at «string»:7:40:

            6|   flake = getFlake "/home/austin/work/nix-postgres";
            7|   pkg = flake.packages.${currentSystem}.psql_15/exts/pg_hashids or flake.psql_15/exts/pg_hashids;
             |                                        ^
            8|   inherit (flake) outPath;
Traceback (most recent call last):
...

The error'ing line itself is pretty clear:

pkg = flake.packages.${currentSystem}.psql_15/exts/pg_hashids or flake.psql_15/exts/pg_hashids;

The name is generated by way of flattenTree from flake-utils so, it isn't exactly a super strange case IMO. I think just enclosing the name in general is enough if there's a slash. Really, we could just do this unconditionally, since there isn't any real difference between x.y and x."y" other than variable interpolation?

The following command works, in contrast, but is obviously strange:

nix-update --flake --version=branch \"psql_15/exts/pg_hashids\"

@figsoda
Copy link
Collaborator

figsoda commented Aug 1, 2023

could you test if #179 fixes the issue for you?

@thoughtpolice
Copy link
Author

Yep, that works. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants