Skip to content

Leverage the "uniform" in URLs for flake refs more #6304

@NobbZ

Description

@NobbZ

brief problem statement

Currently using non-default hosts for gitlab: and sourcehut: schema feels foreign and backwards. It requires manual intervention and reordering components of the repositories URL when adding them to a flakes input set via copy and paste.

Also nested groups in GitLab cause confusion in URL notation.

prefered solution

Instead of passing the host via a "query parameter" we could use the URL format better and more efficient.

Section 3 of RFC 3986 has a complicated way to say that the "authority" (combined user/host) is optional.

So after reading this, we could use the optionality of the authority to make gitlab:owner/repo?host=example.com to gitlab://example.com/owner/repo. This would be much more natural to read, and at the same time gitlab:owner/repo with an assumed authority of gitlab.com would remain as valid.

To also further reduce confusion of branch/tag names or commit SHAs vs. nested GitLab groups the commit ID should be completely removed from the URLs path and instead a query parameter should be used (among all schemas supporting a similar feature, including but not limited to git+* or github). gitlab:owner/repo/branch would then become gitlab:owner/repo?rev=branch and could not get confused anymore with gitlab:org/group/repo.

We might consider allowing an alternative character for starting the query string to avoid having to escape it on the terminal.

alternatives

Continue confusing and Non-uniform Resource Locators.

additional context

I considered going through the RFC process for a moment, but decided not to, as to my understanding the flakes itself haven't yet passed the process.

Though if this suggestion requires to go through the process, I am happy to continue there.

Metadata

Metadata

Assignees

Labels

fetchingNetworking with the outside (non-Nix) world, input lockingflakesidea approvedThe given proposal has been discussed and approved by the Nix team. An implementation is welcome.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions