a-kenji / nix-uri

Parse the nix-uri scheme
MIT License
2 stars 1 forks source link

Add `gitea` to forge parsing #152

Open a-kenji opened 3 weeks ago

Ben-PH commented 3 weeks ago

Worth rolling this into the l2r-parsing PR, or one thing at a time?

Ben-PH commented 3 weeks ago

https://github.com/a-kenji/nix-uri/blob/5c7240e18bedf031b83b25d8fcc4f133f9d65678/src/flakeref/forge.rs#L58-L75

My understanding is that the url for gitea is of git@gitea.com:owner/repo#ref-or-rev

that # could make things difficult for adding in attribute-awareness.

From what I gather, nix itself doesn't specify any rules. We could just specify for ourselves that we use / for separation, and just map that second / to a # strictly for the purpose of dispatching a URL fetch.

on second thoughts, though, that would be problematic. in the context of "copy-pasting" the url from gitea website, the specs are incompatable.

one option would be to separate a gitea flakeref from its attributes with a double ##. if we share the ref/rev separator with the attr separator, there is no way to tell if we are looking at an attribute or ref/rev

a-kenji commented 4 days ago

on second thoughts, though, that would be problematic. in the context of "copy-pasting" the url from gitea website, the specs are incompatable.

Yes, that's why I added a convenience parser in the toplevel, that attempts to convert normal github.com links to flakerefs. The problem there currently is that it can not be entirely correct without additional information, as we don't know whether the user wants the github flakeref, or the tarball spec.