Nixpkgs/Automatic Updates: Difference between revisions
m Minor grammar/formatting |
SarahClark (talk | contribs) m →A special note for Python Monorepos: fix case |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 28: | Line 28: | ||
If you want functionality similar to that of unstableGitUpdater but with the additional handlers offered by nix-update, use: | If you want functionality similar to that of unstableGitUpdater but with the additional handlers offered by nix-update, use: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix">passthru.updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };</syntaxhighlight> | ||
passthru.updateScript = nix-update-script { extraArgs = [ "--version= | |||
</syntaxhighlight> | ==== Setting a custom for prefixed releases ==== | ||
<code>nix-updater</code> expects an all-numeric version such as <code>1.2.3</code> and fails when there's a prefix (<code>v1.2.3</code>). When that happens, you'll need to set a custom regex:<syntaxhighlight lang="nix"> | |||
passthru.updateScript = nix-update-script { | |||
extraArgs = [ "--version-regex=v([\\d.]+)" ]; | |||
}; | |||
</syntaxhighlight>Note there's only one capturing group (in parentheses). Due to a quirk in the updater, nesting capturing groups won't give the results you expect. The regex implicitly matches the whole line. | |||
=== Git Updater === | === Git Updater === | ||
| Line 62: | Line 68: | ||
}; | }; | ||
</syntaxhighlight>Source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/common-updater/unstable-updater.nix | </syntaxhighlight>Source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/common-updater/unstable-updater.nix | ||
== Working with Monorepos == | |||
A monorepo contains multiple packages that are released individually. You will need to define <code>passthru.updateScript</code> and add a version regex (<code>nix-update-script</code>) or a prefix (git updaters). | |||
=== When automatic updates fail === | |||
Updates can fail with "no matching tag found" when the repo pushes out a large number of packages. <code>nix-update-script</code> examines approximately the last 20 releases. In this case, you can switch to the git updater with <code>rev-prefix</code>. | |||
The git updaters also look at a limited window of changes. You still need to verify periodically that your package has updated to the latest version and make the edits by hand if it's behind. | |||
=== A special note for Python monorepos === | |||
The committers run a fast bulk python update script several times a year. This script ignores <code>passthru.updateScript</code> and use the latest git tag. That often breaks monorepo-based packages by setting the wrong <code>src.version</code> expression and/or version number. | |||
Set <code>passthru.skipBulkUpdate = true;</code> to have the special updater skip your package. | |||
== Additional Resources == | == Additional Resources == | ||