You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Well, I'm not sure how it should be parsed, but I just spend quite some debugging time to find out that nix parses x:x not as the identity function but as the string "x:x"; so we appearantly have to always put a space after a :.
This may be a good coding convention, but then I'd like x:y to error. If this is there to allow uris, maybe we can match for :// instead of just :
The parsing is documented to follow RFC 2396 URIs which do allow schemes without //. We might change this on a major nix bump to get more intuitive, but certainly not just to some ad-hoc rule...
Interesting. But RFC2396 even allows the following URI (if I've correctly read the BNF): a:;
and nix isn't accepting it. Pretty much everything else it seems though.
hm, I guess we have to let it be like this then.
Is there any reason for the current special parsing of URIs? With parsing paths, I get that the purpose is resolving relative paths, but that doesn't make sense for URIs. Maybe in the major version bump we can just remove it :).
Well, yes, it's not very useful currently. It saves you quoting around the URL but in exchange you can't anti-quote, so I often (have to) use the quotes anyway.
The reason why we have special parsing of URIs is because Nix is a DSL for describing packages, and packages descriptions almost always contain URIs, so it's convenient to have some special syntax for them.
One idea: forbid general URIs and instead require all of them to have //. I imagine this would help with problems like this one and #1017 and also don't break too much code.
Activity
lucabrunox commentedon Mar 8, 2016
It's indeed unexpected to be a string. But I guess changing this would require a nix 2.0?
vcunat commentedon Mar 8, 2016
The parsing is documented to follow RFC 2396 URIs which do allow schemes without
//. We might change this on a major nix bump to get more intuitive, but certainly not just to some ad-hoc rule...fkz commentedon Mar 8, 2016
Interesting. But RFC2396 even allows the following URI (if I've correctly read the BNF):
a:;and nix isn't accepting it. Pretty much everything else it seems though.
hm, I guess we have to let it be like this then.
Ericson2314 commentedon Mar 8, 2016
Is there any reason for the current special parsing of URIs? With parsing paths, I get that the purpose is resolving relative paths, but that doesn't make sense for URIs. Maybe in the major version bump we can just remove it :).
vcunat commentedon Mar 9, 2016
Well, yes, it's not very useful currently. It saves you quoting around the URL but in exchange you can't anti-quote, so I often (have to) use the quotes anyway.
copumpkin commentedon Mar 9, 2016
I'd be in favor of killing unquoted URLs in some upcoming language revision :) the fewer special cases in the language, the happier I am
Ericson2314 commentedon Mar 10, 2016
We can always add a nixpkgs lib function or builtin to validate URIs if the need arises too.
edolstra commentedon Mar 10, 2016
The reason why we have special parsing of URIs is because Nix is a DSL for describing packages, and packages descriptions almost always contain URIs, so it's convenient to have some special syntax for them.
domenkozar commentedon Aug 8, 2016
But I wonder what value that really gives us? I haven't seen much usage from having them as special type.
abbradar commentedon Aug 9, 2016
One idea: forbid general URIs and instead require all of them to have
//. I imagine this would help with problems like this one and #1017 and also don't break too much code.Ericson2314 commentedon Aug 9, 2016
I suppose that's better than status quo, but I'd really like to get rid if it all together. Could we put it to a vote or something?
stale commentedon Feb 15, 2021
I marked this as stale due to inactivity. → More info
stale commentedon May 2, 2022
I closed this issue due to inactivity. → More info
tomberek commentedon Aug 13, 2026
Closing as stale. Re-open if needed.