niv icon indicating copy to clipboard operation
niv copied to clipboard

Custom updater script

Open srghma opened this issue 5 years ago • 4 comments

How would I use niv to update package, that requires custom update script?

For example

to update https://github.com/srghma/nixpkgs/blob/aadfa893ab25d2410590faff1e3fbbdd4d89b2e3/pkgs/applications/misc/hubstaff/default.nix

there is a script https://github.com/srghma/nixpkgs/blob/aadfa893ab25d2410590faff1e3fbbdd4d89b2e3/pkgs/applications/misc/hubstaff/update.sh

that finds last version of hubstaff package on s3 and makes file https://github.com/srghma/nixpkgs/blob/aadfa893ab25d2410590faff1e3fbbdd4d89b2e3/pkgs/applications/misc/hubstaff/revision.json that is then imported builtins.fromJSON (builtins.readFile ./revision.json);


How would one use niv for hubstaff?

Could niv configuration file store script that is needs to run in order to update?

srghma avatar Jun 24 '19 11:06 srghma

Forgot to reply, even though I gave this a lot of thought. I think we can add a field in the package spec like { owner = "foo"; repo = "bar"; updater = "path/to/updater"; } where path/to/updater is the path to a custom script (like hubstaff's update.sh). What do you think?

nmattia avatar Oct 26 '19 14:10 nmattia

I think it makes more sense to make the updater not script, but derivation that builds a script

srghma avatar Oct 26 '19 19:10 srghma

If we adopted the overlays approach in https://github.com/nmattia/niv/pull/137, we could plausibly have an __updaters attrset that maps an updater value to a derivation that produces some updated attrs.

michaelpj avatar Nov 06 '19 15:11 michaelpj

FWIW I started some work here: https://github.com/nmattia/niv/tree/nm-custom Was out since but will resume work soon.

nmattia avatar Jan 07 '20 14:01 nmattia