check isFlake in nixpkgsFlakeRef#15175
Merged
edolstra merged 1 commit intoNixOS:masterfrom Feb 10, 2026
Merged
Conversation
To get `bashInteractive`, `nix develop` currently [gets a flake reference to nixpkgs](https://github.com/NixOS/nix/blob/3b473c4be5e6abc58aa43271f35ff127af806c55/src/nix/develop.cc#L650-L658), either from [`inputs.nixpkgs`](https://github.com/NixOS/nix/blob/3b473c4be5e6abc58aa43271f35ff127af806c55/src/libcmd/installable-flake.cc#L204) or [`<nixpkgs>`](https://github.com/NixOS/nix/blob/3b473c4be5e6abc58aa43271f35ff127af806c55/src/libcmd/include/nix/cmd/installable-flake.hh#L87). Currently, this is done by name for any (locked) reference. For any `nixpkgs` reference lacking a `flake.nix`, `nix develop` thus errors: ``` error (ignored): path '.../flake.nix' does not exist ``` While the registry does not expose info to help check this, flake inputs expose the `flake` boolean. This means that given `inputs.<name>.flake = false;`, we may know in advance that our reference should not be to a flake. This change incorporates this, so that given `inputs.nixpkgs.flake = false;`, `nix develop` will fall back `<nixpkgs>` to use its flake for `bashInteractive`. While Nixpkgs itself of course does expose a flake, this check is relevant in particular for dummy inputs (e.g. inputs using `{ url = "file:/dev/null"; flake = false; }`), which may be overridden by `--override-input` or `.follows`, yet do not expose (flake) code themselves. Signed-off-by: cinereal <cinereal@riseup.net>
Member
|
Getting Furthermore none of this will be necessary when we implement That said, since we don't have that yet, I would suggest to go ahead with this change, which is good. |
edolstra
approved these changes
Feb 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a check for
isFlakeinnixpkgsFlakeRef.Motivation
To get
bashInteractive,nix developcurrently gets a flake reference to nixpkgs, either frominputs.nixpkgsor flake registry entrynixpkgs.Currently, this is done by name for any (locked) reference. For any
nixpkgsreference lacking aflake.nix,nix developthus errors:Now, given a
inputs.<name>.flake = false;, we may know in advance that our reference should not be a reference to a flake.This change incorporates this knowledge, so that given
inputs.nixpkgs.flake = false;,nix developwill fall back to flake registry entrynixpkgsto use as its flake forbashInteractive.While Nixpkgs itself of course does expose a flake, this check is relevant in particular for dummy inputs (e.g. inputs using
{ url = "file:/dev/null"; flake = false; }), which may be overridden by--override-inputor.follows, yet do not expose (flake) code themselves.Context
nixpkgsFlakeReference, which reflects current use of the function, although thefetch-treeexperimental feature has broadened the use of what were historically called flake references beyond use to refer to flake-enabled source trees.Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.