Mirrors are a very good idea for project to have.
-
Increases project resiliance as all servers go down so ideally something should be online to fallback to
-
Helps accessibility as some regions block users based on sanctions & others might not agree to the terms of service or privacy laws in the jurisdiction of some options
-
If self-hosted, then you/your project owns the code — which can help with potential censorship
At the time of writing, Nix flakes does not & cannot support mirrors in input pinning requiring an input pinner like Nixtamal to automate it.
How to pin a repository with mirrors in Nix + Nixtamal
Mirrors are not supported on all kinds (fetcher limitations) however these can be supported:
-
File
-
Archive
-
Darcs
-
Pijul
-
Git (only in eval time fetching using builtins.fetchGit)
Let’s show the way using the Soupault repository, but if it’s one of the supported kinds, any will work.
Latest revision
// manifest.kdl inputs { soupault { archive { url "https://codeberg.org/PataphysicalSociety/soupault/archive/{{fresh-value}}.tar.gz" mirrors "https://github.com/PataphysicalSociety/soupault/archive/{{fresh-value}}.tar.gz" } } fresh-cmd { $ git ls-remote --branches main "https://codeberg.org/PataphysicalSociety/soupault.git" | cut -f1 } }