Check out FlakeHub — the best place to discover and publish Nix flakes, from Determinate Systems.

Sign up for the Determinate Systems mailing list

* indicates required

Pinning dependencies

Fixing a Nix dependency to a specific revision

Concepts / Pinning dependencies

We recommend starting with the Nix quick start and consulting concept docs primarily for clarification. Feel free to click x to the right to disable this notification on all concept docs.

Pinning a dependency refers to the act of specifying an exact revision for Nix to use. This is particularly interesting in relation to Nix’s reproducibility guarantees.

When you pin Nix dependencies to a specific revision you are guaranteed to get the same outputs of builds, based on the same inputs, which cannot change. This is particularly useful when sharing environments between different developers, or between a development and production environment.

Pinning dependencies can be done in the inputs section of the flakes file:

{
inputs = {
nixpkgs.url = "git+https://github:nixos/nixpkgs?rev=fdc8ef970de2b4634e1b3dca296e1ed918459a9e";
};
}

Was this page helpful?