Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix flake pin: Mark the resulting registry entry as exact #12581

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

edolstra
Copy link
Member

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 👍 to pull requests you find important.

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

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`.
@github-actions github-actions bot added new-cli Relating to the "nix" command fetching Networking with the outside (non-Nix) world, input locking labels Feb 28, 2025
@edolstra edolstra added the backport 2.27-maintenance Automatically creates a PR against the branch label Feb 28, 2025
@roberth
Copy link
Member

roberth commented Mar 1, 2025

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

@edolstra
Copy link
Member Author

edolstra commented Mar 1, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.27-maintenance Automatically creates a PR against the branch fetching Networking with the outside (non-Nix) world, input locking new-cli Relating to the "nix" command
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants