Source updater for git repos

I know of and often use the pkgs/common-updater/scripts/update-source-version script for updating packages. But it needs that the source url depends on the version string.

For packages that hardcode the revision in a repo this doesn’t work, but IMO those are packages where automation would be most helpful.

Do you have a workflow that automates this, or is there a way to use the updater script afterall?

AFAIK, changing a url which has hard-coded version information requires manual work. Hopefully the next time the package needs an update, someone will parameterize version so it can get the benefits of automatic updates.

See the help in nix-shell maintainers/scripts/update.nix and passthru.updateScript in the nixpkgs manual Nixpkgs 23.11 manual | Nix & NixOS.

I’m mainly thinking about packages like pkgs/misc/emulators/dolphin-emu/master.nix, that track the master or another branch, but not a tagged version. I often want to test newer version. This would also be helpful when trying a certain revision for a stable package that normally works with update-source-version, but where I want to set rev myself.

Maybe updating the script allowing for a deeper nesting of the update-source-version would work, but that seems like a lot of parsing in a shell script…

For my one packages maintainers/scripts/update.nix sounds like a good alternative though.

you can use builtins.fetchGit without revision to fetch the latest one. That’s what I use to build latest neovim.

1 Like