Skip to content

fetchFrom{Forgejo,Codeberg}: init, treewide: fetchFromGitea -> fetchFromCodeberg, docs#483216

Merged
gepbird merged 4 commits intoNixOS:masterfrom
SigmaSquadron:push-mkkvlltusqxm
Jan 31, 2026
Merged

fetchFrom{Forgejo,Codeberg}: init, treewide: fetchFromGitea -> fetchFromCodeberg, docs#483216
gepbird merged 4 commits intoNixOS:masterfrom
SigmaSquadron:push-mkkvlltusqxm

Conversation

@SigmaSquadron
Copy link
Contributor

@SigmaSquadron SigmaSquadron commented Jan 23, 2026

Closes #482855

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

@SigmaSquadron SigmaSquadron added the 6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) label Jan 23, 2026
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: qt/kde Object-oriented framework for GUI creation 6.topic: vim Advanced text editor 6.topic: zig Zig is an imperative, general-purpose, statically typed, compiled system programming language. 8.has: documentation This PR adds or changes documentation labels Jan 24, 2026
@saltrocks
Copy link
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 483216
Commit: 05ec691d4671e1b88cb5222e7223e01ce7ce4cab


x86_64-linux

✅ 1 package built:
  • nixpkgs-manual

@SigmaSquadron
Copy link
Contributor Author

Yes, logically this should be a zero-rebuild. The main review concern here is whether the implementation for fetchFromCodeberg isn't too terrible.

@nixpkgs-ci nixpkgs-ci bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jan 27, 2026
Copy link
Contributor

@gepbird gepbird left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I like this approach, the first time I encountered a codeberg source I was surprised there's no fetcher for it despite the platform being quite popular. It also feels weird to write fetchFromGitea for forgejo sources.

Grepped for domain = "codeberg.org", can you also migrate these to fetchFromCodeberg? I think a new commit would be preferable:

  • pkgs/by-name/xr/xrsh/package.nix
  • pkgs/applications/networking/browsers/librewolf/src.nix
  • pkgs/by-name/go/gotosocial/package.nix
  • pkgs/by-name/ka/katawa-shoujo-re-engineered/package.nix

In your last commit, what is the reason for the second sed call, shouldn't the first one catch trivial instances? I wonder if it can introduce other issues: what if a package has a codeberg source AND non-codeberg gitea source (e.g. a subpackage in the same file)?

for i in (rg 'fetchFromGitea \{\n *domain = "codeberg.org";' --multiline --files-with-matches)
    sed -z 's/fetchFromGitea {\n *domain = "codeberg.org";/fetchFromCodeberg {/g' $i > $i.tmp && mv $i.tmp $i
    sed -i 's/fetchFromGitea/fetchFromCodeberg/g' $i
end

(Slightly related: in another PR programs.forgejo-actions-runnermodule would be nice that acts as programs.gitea-actions-runner with programs.gitea-actions-runner.package = pkgs.forgejo-runner, what do you think?)

SigmaSquadron and others added 4 commits January 31, 2026 21:08
It's 'fetchFromGitea', with the domain already set.

Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
Simple alias, as Gitea's fetcher is compatible with Forgejo.

Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
…o and fetchFromCodeberg

Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
Most packages that used fetchFromGitea fetch their sources from Codeberg, so might as well migrate them.

The following command was used for this treewide:
```fish
for i in (rg 'fetchFromGitea \{\n *domain = "codeberg.org";' --multiline --files-with-matches)
    sed -z 's/fetchFromGitea {\n *domain = "codeberg.org";/fetchFromCodeberg {/g' $i > $i.tmp && mv $i.tmp $i
    sed -i 's/fetchFromGitea/fetchFromCodeberg/g' $i
end
```

The following paths were manually edited:

* pkgs/by-name/xr/xrsh/package.nix
* pkgs/applications/networking/browsers/librewolf/src.nix
* pkgs/by-name/go/gotosocial/package.nix
* pkgs/by-name/ka/katawa-shoujo-re-engineered/package.nix

Co-authored-by: Gutyina Gergő <gutyina.gergo.2@gmail.com>
Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
@SigmaSquadron
Copy link
Contributor Author

Thanks for the review! The individual comments were addressed, and the treewide was updated.

Grepped for domain = "codeberg.org", can you also migrate these to fetchFromCodeberg? I think a new commit would be preferable:

* pkgs/by-name/xr/xrsh/package.nix

* pkgs/applications/networking/browsers/librewolf/src.nix

* pkgs/by-name/go/gotosocial/package.nix

* pkgs/by-name/ka/katawa-shoujo-re-engineered/package.nix

I've updated the treewide commit, since it had a conflict and adding these wouldn't be too much of a hassle.

In your last commit, what is the reason for the second sed call, shouldn't the first one catch trivial instances?

The reason is, as usual, because I'm bad at programming. I know I could probably have done it in a nicer way, but I couldn't be bothered for such a quick task.

I wonder if it can introduce other issues: what if a package has a codeberg source AND non-codeberg gitea source (e.g. a subpackage in the same file)?

Eval should catch edge cases like that, but I don't think we have any.

(Slightly related: in another PR programs.forgejo-actions-runnermodule would be nice that acts as programs.gitea-actions-runner with programs.gitea-actions-runner.package = pkgs.forgejo-runner, what do you think?)

I think it's a wonderful idea, and probably reasonably easy to implement given that options don't store their original path in their attributes. I'll attempt this in another PR.

@nixpkgs-ci nixpkgs-ci bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Jan 31, 2026
Copy link
Contributor

@gepbird gepbird left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In your last commit, what is the reason for the second sed call, shouldn't the first one catch trivial instances?

The reason is, as usual, because I'm bad at programming. I know I could probably have done it in a nicer way, but I couldn't be bothered for such a quick task.

Now I realized: you wanted to replace the import at the top, in this case including the comma is safer:

    sed -i 's/fetchFromGitea,/fetchFromCodeberg,/g' $i

I wonder if it can introduce other issues: what if a package has a codeberg source AND non-codeberg gitea source (e.g. a subpackage in the same file)?

Eval should catch edge cases like that, but I don't think we have any.

I can never be too sure about that when working with FODs, just in case I quickly scrolled through the treewide.
There was a file with 2 gitea sources, but both was hosted on codeberg. Overall no issues in the diff!

@nixpkgs-ci nixpkgs-ci bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jan 31, 2026
@SigmaSquadron
Copy link
Contributor Author

(Slightly related: in another PR programs.forgejo-actions-runnermodule would be nice that acts as programs.gitea-actions-runner with programs.gitea-actions-runner.package = pkgs.forgejo-runner, what do you think?)

I think it's a wonderful idea, and probably reasonably easy to implement given that options don't store their original path in their attributes. I'll attempt this in another PR.

#485596

@gepbird gepbird added this pull request to the merge queue Jan 31, 2026
Merged via the queue into NixOS:master with commit e3fd108 Jan 31, 2026
31 of 34 checks passed
@SigmaSquadron SigmaSquadron deleted the push-mkkvlltusqxm branch January 31, 2026 12:44
@SuperSandro2000
Copy link
Member

Are there any plans to backports this to make other backports easier and with fewer conflicts?

@SigmaSquadron SigmaSquadron added the backport release-25.11 Backport PR automatically label Feb 8, 2026
@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented Feb 8, 2026

Backport failed for release-25.11, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release-25.11
git worktree add -d .worktree/backport-483216-to-release-25.11 origin/release-25.11
cd .worktree/backport-483216-to-release-25.11
git switch --create backport-483216-to-release-25.11
git cherry-pick -x dcc52f0124398d37e1c10c5778dcbfa6ac3433dc adf7a4850b7d89c0658bdae2daff9680832680a7 a1c9639328fb90f894a726d6bca0896fab878b36 3562403503f705f700bcbd9b1c1bae1c6641f519

@SigmaSquadron
Copy link
Contributor Author

Doing a manual backport as soon as I finish up with a package update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: qt/kde Object-oriented framework for GUI creation 6.topic: vim Advanced text editor 6.topic: zig Zig is an imperative, general-purpose, statically typed, compiled system programming language. 8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. backport release-25.11 Backport PR automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create fetcher fetchFromCodeberg

4 participants