forgejo/release-notes/8.0.0/feat/3615.md

1.1 KiB

Support the Nix tarball fetcher immutable link protocol on archive URLs, so Forgejo-generated tarballs for branches will go into Nix's flake.lock as their respective commit URLs and nix flake update will just work. This allows natively fetching Forgejo repositories for Nix flake inputs as tarballs rather than as Git repositories, significantly improving fetch times and avoiding depending on Git at runtime.

Concretely, Forgejo now returns a header of the following format from its archive URLs: Link: <https://my-forgejo/api/v1/someuser/somerepo/archive/some-commit-hash.tar.gz?rev=some-commit-hash> rel="immutable".

Example usage: inputs.meow.url = "https://my-forgejo/someuser/somerepo/archive/main.tar.gz"; in flake.nix. For a private repository, configure netrc-file in nix.conf and use https://my-forgejo/api/v1/repos/someuser/somerepo/archive/main.tar.gz as a URL instead, since the normal archive endpoint doesn't support tokens.