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

Ignore local registries for lock file generation #12019

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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

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
None yet
Development

Successfully merging this pull request may close these issues.

Disable system and user registry for locking
4 participants