Reference

Pin declarations

pin.mk, pin.github, pin.git, and the relationship between Pins, Sources, and Packages.

A declaration file is a Nix function returning an attribute set keyed by Pin name. It can request pin, pkgs, and lib; declare only the arguments you need:

{ pin }: {
  patchelf = pin.github "NixOS/patchelf";
}

Data hierarchy

  • Pin: one Checker, one Version, and one or more Sources; the atomic unit of selection and updates.
  • Source: one Fetcher, one source Hash, and that Source's patches and Packages.
  • Package: one Builder with its dependency artifacts and Derived Hash.

pin.mk

Combine Checkers, Fetchers, and Packages independently. For a single Source, provide a top-level fetcher; the Source is named default:

{ pin }: {
  demo = pin.mk {
    checker = pin.checker.cmd "printf '0.18.0'";
    fetcher = pin.fetcher.github {
      target = "NixOS/patchelf";
    };
  };
}
FieldMeaning
checkerRequired; from pin.checker.*
sourcesOptional nonempty attribute set of named Sources
fetcherRequired when sources is absent; single-Source shorthand
patchesPatch list for a single Source; defaults to []
postPatchPatch script for a single Source; defaults to an empty string
packagesNamed Package attribute set for a single Source; defaults to {}

For multiple Sources, put fetcher, patches, postPatch, and packages inside each Source. See Multiple Sources.

pin.github

Accepts an "owner/repo" string or structured arguments. Combines a GitHub release Checker with a GitHub Fetcher and creates only the default Source.

{ pin }: {
  patchelf = pin.github {
    target = "NixOS/patchelf";
    rev = version: version;
  };
}

Specify the target using either target or owner and repo; do not mix them. Other fields are rev, fetcherArgs, patches, postPatch, and packages.

pin.git

Accepts a repository URL string or structured arguments. Combines a Git Checker with a Git Fetcher and creates only the default Source. By default, it tracks Git HEAD:

{ pin }: {
  patchelf = pin.git "https://github.com/NixOS/patchelf.git";
}

Structured arguments must use target. You can also set the Checker's mode, branch, ref, include, exclude, and sort; the Fetcher's rev and fetcherArgs; and the Source's patches, postPatch, and packages.

Use pin.mk for more complex combinations. Unknown declaration fields, Fetcher mapping errors, and deterministic configuration errors are reported before Checkers run.