nix/flake: installables exclude attribute path from URL #1819
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
I ran into an issue causing the generated
.devbox/gen/flake
to contain an invalid flake reference when adding some installables todevbox.json
, specifically those which pointed to a remote resource. Local files were fine.After a quick hike around the repo, the fix seemed trivial enough to open up a PR rather than open up an issue. Interestingly, I didn't seem to find any issues around this even though this bug would've been around for some months.
As it turns out,
Installable
s returned fromParseInstallable
included the attribute path when provided a value with any scheme aside from<empty string>
,flake
,path
, orgithub
. This was because theparseURLRef
method was not separating the fragment out of the refURL. More generically, the affected branches were any of those that setparsed.URL
to the result ofrefURL.String()
, since that specific method will re-addFragment
unless its empty.Additionally, the test for
ParseInstallable
with a flake was passing because the test case itself had an invalid flake reference. I corrected that, as well as adding a couple of relevant test cases for some other types as well.Repo steps
devbox.json
e.g.
https://github.com/NixOS/patchelf/archive/master.tar.gz#patchelf
nix
error:How was it tested?