How can I run the updateScript of personal packages?

I have a few packages in a personal repository that I’ve been occasionally updating manually. I see that nixpkgs has some tooling around passthru.updateScript that helps automate this.

Is there a way for me to use that in my own repository? I’d love to be able to set e.g.

passthru.updateScript = gitUpdater { };

and then just run some command to update the package locally.

2 Likes

It is definitely possible, I do it in my personal repository using a custom script that calls update.nix from Nixpkgs. The most important thing is to pass overlay containing your packages to update.nix and some update scripts may require having packages available as top-level attributes from default.nix (which will require extra boilerplate when using flakes).

Though not all updateScripts will work out of the box – adjustments to the detection of edited file path might be needed.

1 Like

Wonderful, thanks! I’m not sure I have the cleanest implementation but at least got something running:

$ ./tasks/update 

Going to be running update for following packages:
 - apex-unstable-2021-12-09
 - cavif-1.5.0
 - decompiler-mc-unstable-2022-06-21
 - fastnbt-tools-0.25.0
 - git-diff-image-unstable-2023-01-01
 - gpx-reduce-unstable-2022-11-18
 - mcaselector-2.1
 - minemap-1.0.26
 - nbt-explorer-2.8.0
 - pngquant-interactive-0.1.0
 - tile-stitch-unstable-2019-07-10
 - trafilatura-1.3.0
 - wireguard-vanity-address-0.4.0

Press Enter key to continue...

Running update for:
 - apex-unstable-2021-12-09: UPDATING ...
 - cavif-1.5.0: UPDATING ...
 - decompiler-mc-unstable-2022-06-21: UPDATING ...
 - fastnbt-tools-0.25.0: UPDATING ...
 - fastnbt-tools-0.25.0: DONE.
 - git-diff-image-unstable-2023-01-01: UPDATING ...
 - cavif-1.5.0: DONE.
 - gpx-reduce-unstable-2022-11-18: UPDATING ...
 - apex-unstable-2021-12-09: DONE.
 - mcaselector-2.1: UPDATING ...
 - decompiler-mc-unstable-2022-06-21: DONE.
 - minemap-1.0.26: UPDATING ...
 - gpx-reduce-unstable-2022-11-18: DONE.
 - nbt-explorer-2.8.0: UPDATING ...
 - git-diff-image-unstable-2023-01-01: DONE.
 - pngquant-interactive-0.1.0: UPDATING ...
 - minemap-1.0.26: DONE.
 - tile-stitch-unstable-2019-07-10: UPDATING ...
 - mcaselector-2.1: DONE.
 - trafilatura-1.3.0: UPDATING ...
 - trafilatura-1.3.0: DONE.
 - wireguard-vanity-address-0.4.0: UPDATING ...
 - nbt-explorer-2.8.0: DONE.
 - wireguard-vanity-address-0.4.0: DONE.
 - pngquant-interactive-0.1.0: DONE.
 - tile-stitch-unstable-2019-07-10: DONE.

Packages updated!

nix-update is impressive.