Terrible error messages from missing defexpr components #715
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
awaiting
author
awaiting
contributors
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
Feature/S3
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
ux
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lix-project/lix#715
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Describe the bug
I can't install packages via nix-env but can with nix-shell
Steps To Reproduce
nix-env -iA nixpkgs.helloerror: attribute 'nixpkgs' in selection path 'nixpkgs.hello' not found inside path '', whose contents are: { \_combineChannels = [ ]; }note that
nix-shell -p helloworks as expectedExpected behavior
A clear and concise description of what you expected to happen.
nix --versionoutputnix (Lix, like Nix) 2.92.0
System type: aarch64-linux
Additional system types:
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /home/north/.config/nix/nix.conf:/etc/xdg/nix/nix.conf
Store directory: /nix/store
State directory: /nix/var/nix
Additional context
OS: Fedora Linux Asahi Remix 41 (Workstation Edition) aar4
Host: Apple MacBook Pro (16-inch, M2 Max, 2023)
Kernel: Linux 6.12.12-400.asahi.fc41.aarch64+16k
Add any other context about the problem here.
This is definitely some nonsense with channels on the machine. It's unlikely to be a bug.
The symptom you're seeing is one caused by the channel 'nixos' in the nix "default expression" (if that sounds unhinged and confusing, I agree!) not being present. See "Default Nix expression" in the nix-env man page. This is a separate thing (which nearly nobody uses today) from the NIX_PATH resolution of stuff like
<nixpkgs>that is used by nix-shell -p (which makes up a funny expression string).This error message is certainly terrible, but I suspect it to be an improvement over what it used to be, because horrible errors from this command ring a bell.
Practically, the upshot of all this is you want to use
nix-env -f '<nixpkgs>' -iA helloinstead. Yes that's clunky. The more reasonable thing to use is flakey-profile, which completely eliminates most of these terrible commands.I can't install packages via nix-env but can with nix-shellto Terrible error messages from missing defexpr componentsOh wow, I had read some solutions and thought the "<nixpkgs>" was something I needed to change to something and the error message usually had something inside the ' '
After trying running the command I can confirm it works. Thank you so much
You've actually run into an error message I rewrote myself this release. If there's any wording tweaks you can think of that would eliminate some confusion, those would be helpful.
(note that saying explicitly that it's defexpr resolution failure is definitely something that would help but that's a separate problem, the error message you saw is what you get for all -A missing attributes)
has the message been changed / improved since the issue was opened?
It did not change AFAIK.