nix icon indicating copy to clipboard operation
nix copied to clipboard

nix registry pin: Mark the resulting registry entry as exact

Open edolstra opened this issue 10 months ago • 3 comments

Motivation

Since the resulting target flakeref contains attributes like lastModified or narHash, it's not suitable for overriding. This led to errors like

$ nix build nixpkgs/24.05#hello
error: 'lastModified' attribute mismatch in input 'github:NixOS/nixpkgs/63dacb46bf939521bdc93981b4cbb7ecb58427a0', expected 1728538411, got 1717179513

after doing nix registry pin nixpkgs.

Context


Add :+1: to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

edolstra avatar Feb 28 '25 14:02 edolstra

What is exact? It's not documented in the manual or on the C++ field.

roberth avatar Mar 01 '25 15:03 roberth

It means that the registry entry is only used to rewrite the given flakeref if it's exactly equal to the from of the entry. This is useful if you have a registry entry like nixpkgs -> path:/nix/store/... that should match nixpkgs but not e.g. nixpkgs/<branch>. See https://github.com/NixOS/nixpkgs/blob/22d52eb36183414bc4e0dc17ed19955c4988d931/nixos/modules/config/nix-flakes.nix#L68-L76.

edolstra avatar Mar 01 '25 21:03 edolstra

Added a test in https://github.com/NixOS/nix/pull/13229

Mic92 avatar May 19 '25 08:05 Mic92