Skip to content

Ignore local registries for lock file generation#12019

Closed
edolstra wants to merge 2 commits intoNixOS:masterfrom
DeterminateSystems:ignore-local-registries
Closed

Ignore local registries for lock file generation#12019
edolstra wants to merge 2 commits intoNixOS:masterfrom
DeterminateSystems:ignore-local-registries

Conversation

@edolstra
Copy link
Member

@edolstra edolstra commented Dec 6, 2024

Motivation

When resolving indirect flake references like nixpkgs in flake.nix files, Nix will no longer use the system and user flake registries. It will only use the global flake registry and overrides given on the command line via --override-flake.

This avoids accidents where users have local registry overrides that map nixpkgs to a path: flake in the local file system, which then end up in committed lock files pushed to other users.

Fixes #12010.

Context


Add 👍 to pull requests you find important.

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

@github-actions github-actions bot added documentation fetching Networking with the outside (non-Nix) world, input locking labels Dec 6, 2024
When resolving indirect flake references like `nixpkgs` in `flake.nix`
files, Nix will no longer use the system and user flake registries. It
will only use the global flake registry and overrides given on the
command line via `--override-flake`.
@edolstra edolstra force-pushed the ignore-local-registries branch from 0b27c4f to be49fe3 Compare December 6, 2024 11:15
@elikoga
Copy link
Contributor

elikoga commented Dec 6, 2024

The local registry would then only be used to resolve flake references in cli args?

@edolstra
Copy link
Member Author

edolstra commented Dec 6, 2024

@elikoga Yes, that's right.

Copy link
Member

@roberth roberth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fairly straightforward, but I expect this behavior to be documented.
Also a test would be good.

@github-actions github-actions bot added the new-cli Relating to the "nix" command label Dec 9, 2024
@edolstra
Copy link
Member Author

edolstra commented Dec 9, 2024

Added some docs.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2024-12-09-nix-team-meeting-minutes-201/57280/1

@edolstra
Copy link
Member Author

Merged via #12068.

@edolstra edolstra closed this Dec 16, 2024
@edolstra edolstra deleted the ignore-local-registries branch December 16, 2024 14:44
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nix-2-26-released/59211/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation fetching Networking with the outside (non-Nix) world, input locking new-cli Relating to the "nix" command

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Disable system and user registry for locking

4 participants