Skip to content

nix config check: improve error when no nix-env in PATH#15046

Merged
Ericson2314 merged 1 commit intoNixOS:masterfrom
juhp:patch-3
Jan 22, 2026
Merged

nix config check: improve error when no nix-env in PATH#15046
Ericson2314 merged 1 commit intoNixOS:masterfrom
juhp:patch-3

Conversation

@juhp
Copy link
Contributor

@juhp juhp commented Jan 22, 2026

Motivation

When there is no nix-env in PATH the current error message:

$ nix config check --verbose
Running checks against store uri: local
[FAIL] Multiple versions of nix found in PATH:

is a bit confusing.

This change improves the error message in this case to say
No nix-env found in PATH.

Perhaps the current error message could also mention nix-env?

Context

It is possible that the nix executable is installed but not nix-env
(this may be unusual but for example in Fedora we have a separate nix-legacy subpackage,
which includes the nix-env symlink).
This makes sense for rootless usage (without /nix) or for just pure modern workflows in general.


Add 👍 to pull requests you find important.

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

It is possible that the `nix` executable is installed but not `nix-env`
(this may be unusual but for example in Fedora we have a separate
`nix-legacy` subpackage, which includes the `nix-env` symlink).

The current error message:
```
$ nix config check --verbose
Running checks against store uri: local
[FAIL] Multiple versions of nix found in PATH:

```
when there is no nix-env in PATH is confusing.

This change makes the error message precise for the missing nix-env case.
@juhp juhp requested a review from edolstra as a code owner January 22, 2026 04:58
@github-actions github-actions bot added the new-cli Relating to the "nix" command label Jan 22, 2026
@Ericson2314 Ericson2314 added this pull request to the merge queue Jan 22, 2026
Merged via the queue into NixOS:master with commit ba219cb Jan 22, 2026
14 checks passed
@juhp juhp deleted the patch-3 branch January 22, 2026 06:23
@juhp
Copy link
Contributor Author

juhp commented Jan 22, 2026

Thanks @Ericson2314 for reviewing

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

Labels

new-cli Relating to the "nix" command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants