Nixpkgs/Update Scripts: Difference between revisions

From NixOS Wiki
typo
Makefu (talk | contribs)
Add all optional arguments to unstableGitUpdater
Line 1: Line 1:
Update Scripts can be added to packages via setting, <code><nowiki>passthru.updateScript</nowiki></code> which is then executed by [[r-ryantm]] to create an updated pull request or can be manually invoked via <code><nowiki>nix-shell maintainers/scripts/update.nix</nowiki></code>.
Update Scripts can be added to packages via setting, <code><nowiki>passthru.updateScript</nowiki></code> which is then executed by [[r-ryantm]] to create an updated pull request or can be manually invoked via <code>nix-shell maintainers/scripts/update.nix --argstr package <packagename></code>.


== Update Scripts ==
== Update Scripts ==
Line 7: Line 7:
=== Git Updater ===
=== Git Updater ===


Updates to the latest git tag
Updates to the latest git tag.


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
passthru.updateScript = gitUpdater {
passthru.updateScript = gitUpdater {
   ignoredVersions = ""; # Optional Filter to ignore versions
   ignoredVersions = ""; # Optional - Filter to ignore versions
   rev-prefix = "v"; # Optional set if tags have a prefix before the version number
   rev-prefix = "v"; # Optional - set if tags have a prefix before the version number
   odd-unstable = false; # Optional Ignore odd numberd versions
   odd-unstable = false; # Optional - Ignore odd numberd versions
   patchlevel-unstable = false; # Optional Ignore patchlevel versions
   patchlevel-unstable = false; # Optional - Ignore patchlevel versions
   url = null; #  Optional Set this to a git url when the src is not a git repo
   url = null; #  Optional - Set this to a git url when the src is not a git repo
};
};
</syntaxhighlight>
</syntaxhighlight>Source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/common-updater/git-updater.nix


=== Unstable Git Updater ===
=== Unstable Git Updater ===
Line 25: Line 25:
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
passthru.updateScript = unstableGitUpdater {
passthru.updateScript = unstableGitUpdater {
   branch = null; # Optional Which branch should be updated from
   branch = null; # Optional - Which branch should be updated from
   url = null; # Optional Set this to a git url when the src is not a git repo
   url = null; # Optional - The git url, if empty it will be set to src.gitRepoUrl
  tagPrefix = "v"; # Optional - strip this prefix from a tag name
  hardcodeZeroVersion = false; # Optional - Use a made-up version "0" instead of latest tag. Use when the project's tagging system is incompatible with what we expect from versions
  tagFormat = "*"; # Optional - A `git describe --tags --match '<format>'` pattern that tags must match to be considered
  tagConverter = null; # Optional - command to convert more complex tag formats. It receives the git tag via stdin and should convert it into x.y.z format to stdout. Example: https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/ch/chirp/package.nix#L41-L45
  shallowClone = true; # Optional - do not perform a complete clone
};
};
</syntaxhighlight>
</syntaxhighlight>Source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/common-updater/unstable-updater.nix
 
[[Category:Nixpkgs]]
[[Category:Nixpkgs]]

Revision as of 21:47, 5 October 2024

Update Scripts can be added to packages via setting, passthru.updateScript which is then executed by r-ryantm to create an updated pull request or can be manually invoked via nix-shell maintainers/scripts/update.nix --argstr package <packagename>.

Update Scripts

List of prepackaged update scripts.


Git Updater

Updates to the latest git tag.

passthru.updateScript = gitUpdater {
  ignoredVersions = ""; # Optional - Filter to ignore versions
  rev-prefix = "v"; # Optional - set if tags have a prefix before the version number
  odd-unstable = false; # Optional - Ignore odd numberd versions
  patchlevel-unstable = false; # Optional - Ignore patchlevel versions
  url = null; #  Optional - Set this to a git url when the src is not a git repo
};

Source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/common-updater/git-updater.nix

Unstable Git Updater

Updates to the latest git tag

passthru.updateScript = unstableGitUpdater {
  branch = null; # Optional - Which branch should be updated from
  url = null; # Optional - The git url, if empty it will be set to src.gitRepoUrl
  tagPrefix = "v"; # Optional - strip this prefix from a tag name
  hardcodeZeroVersion = false; # Optional - Use a made-up version "0" instead of latest tag. Use when the project's tagging system is incompatible with what we expect from versions
  tagFormat = "*"; # Optional - A `git describe --tags --match '<format>'` pattern that tags must match to be considered
  tagConverter = null; # Optional - command to convert more complex tag formats. It receives the git tag via stdin and should convert it into x.y.z format to stdout. Example: https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/ch/chirp/package.nix#L41-L45
  shallowClone = true; # Optional - do not perform a complete clone
};

Source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/common-updater/unstable-updater.nix