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
Add fetcher: fetchFromSourcehut #102225
Add fetcher: fetchFromSourcehut #102225
Conversation
Should I continue modifying |
One quick question: is the sourcehut url format stable? If yes, never mind, but if it isn't, maybe we should be able to override the function that generates the url! |
I think the domain should be able to change, as far as I know you can host your own instance. Besides that, we need to get the base approved, with how fetchFromSourcehut works, before any more are changed (I would say. Maybe @worldofpeace can help on this? Also tagging @SuperSandro2000 and @mweinelt as they seemed interested in this! |
I hope! |
IIRC Drew has said that the One more thing to note, whereas with GitHub the owner can refer to a person or org on SourceHut the discussion is ongoing on what the organisation (user group) prefix will be. Examples in the air are say |
This is already implemented:
Thanks for the information!
src = fetchFromSourcehut {
owner = "sourcehut";
group = true;
repo = "core.sr.ht";
rev = ...;
sha256 = ...;
};
src = fetchFromSourcehut {
group = "sourcehut";
repo = "core.sr.ht";
rev = ...;
sha256 = ...;
}; Usage example with git.sr.ht/~sourcehut/core.sr.ht in both cases: src = fetchFromSourcehut {
owner = "sourcehut";
repo = "core.sr.ht";
rev = ...;
sha256 = ...;
}; |
Wouldn't it be easer to use one attribute for users and one for groups? src = fetchFromSourcehut {
user = "sourcehut";
repo = "core.sr.ht";
rev = ...;
sha256 = ...;
}; src = fetchFromSourcehut {
group = "sourcehuters";
repo = "core.sr.ht";
rev = ...;
sha256 = ...;
}; |
Might be a better option, although it would make the code more complicated. And also it might end up more confusing if people read the code of the |
I think we should keep the |
having to set a flag if I want to download things from a group is not very intuitiv for people coming from GitHub, GitLab or Gitea because they all don't have that difference.
Didn't you come to the conclusion that groups on sourcehut are a bit different from all other platforms? Than the fetcher can also be a bit different. The fetcher is new and we are not breaking anything so we can do it right the first time. And if users are confused we can throw an explanation if they pass owner into the fetcher. |
I don't know how they work on github and gitlab, so I can't tell if it is different.
That could be a solution, but we are all used to give But if other people think too it should be |
the URL scheme is just the same. github.com/NixOS could be a group or a user.
Or the owner is prefixed with ~ or something else but adding a flag |
Can you please fix the merge conflict? |
I don't want to bikeshed, but by analogy with fetchFromGitHub, I would have expected this to be called fetchFromSourceHut. |
We are already in a bikeshed problem :P
IDK, because it's GitHub, GitLab and SourceForge, but it's sourcehut or Sourcehut, they chose to not capitalize it for some reason. We still need someone to decide the best solution for the group/user/owner/flag problem. |
That's fair, I'm just catching up with the rest of the thread now. What if we just sidestep the owner/group thing altogether, and just say { user ? null
, owner ? "~${user}"
} And if/when they make up their mind about what sigil to use, you could update that to: { user ? null
, group ? null
, owner ? if !isNull group then "^${group}" else "~${user}"
} But in any case there's no reason for this PR to be blocked on that. |
Thanks, this is a great solution! @SuperSandro2000 what do you think? |
sounds go to me. |
Just in case:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you'd add an appropriate section to the nixpkgs manual, that'd be great!
Overall I think this is worth it, for using fetchzip
over fetchgit
and the .hg_archival.txt
deletion.
Also I think it's wise to leave out a fetchFromGitHub
-style fallback to fetchgit
(as has been done here) because that fetcher is quite a mess in terms of internal logic.
I lost track of this since my last comment but I intend to give it a final review tomorrow and hopefully merge it (so that we can also properly fix #115397), so please let me know if there are any important objections (likely not but just to be sure). And if someone else reviews/merges it before that that's obviously fine as well :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested it on nixos-unstable
and everything worked as expected :)
Huge thanks to you @luc65r and also to all the reviewers!
in fetchzip (recursiveUpdate { | ||
inherit name; | ||
url = "${baseUrl}/archive/${rev}.tar.gz"; | ||
meta.homepage = "${baseUrl}/"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meta.homepage = "${baseUrl}/"; | |
meta.homepage = baseUrl; |
On sr.ht the "/" isn't appended and e.g. scdoc
's man page contains "Up-to-date sources can be found at https://git.sr.ht/~sircmpwn/scdoc [...]". So we might want to change this later but it shouldn't really matter much and we could do it at any time.
@@ -475,6 +475,8 @@ in | |||
|
|||
fetchFromSavannah = callPackage ../build-support/fetchsavannah {}; | |||
|
|||
fetchFromSourcehut = callPackage ../build-support/fetchsourcehut { }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit unfortunate that upstream uses (at least) sourcehut
, Sourcehut
, and SourceHut
.
Picking fetchFromSourcehut
should be fine though :)
Motivation for this change
I start to see programs hosted on sourcehut, so I think adding a fetcher will be helpful.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)