nix search
error messages are unhelpfull #985
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
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
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#985
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?
Is your feature request related to a problem? Please describe.
the
nix search
behavior isn't the most intuitive, users are likely to (reasonably) assume thatnix search kate
would search for kate.The error that gives:
with "installable" being an unexplained term, the user would try
nix search kate ^
which just results inLeaving the user with nothing but frustration.
I've both gone trough this myself and seen other users go trough it.
Describe the solution you'd like
The error message for
nix flake search <term>
could check if<term>
is an installable and if not, list the available installables and suggest search trough one of those.Making the error something like
would hopefully be enough to teach users how to use the command.
Additionally, the output of
nix search <installable> <regex>
could list the available installables if the provided one is not found.Describe alternatives you've considered
The term "installable" could be changed to something less likely to be confused with "package"
nix search kate
could instead default to search either a default installable (nixpkgs) or all installables. But that would be breaking compatibility.okay here's the deal: nix search was rewritten 5 years ago to not work well anymore in nix 2.4, when it was rewritten to be totally inseparably tangled with flakes and if I recall correctly also became slow at that point. my practical advice is to use nix-index instead.
i agree that the error could be better written, but one specific clarification i need to make is that "installable" is a very specific term of art defined in the nix3-flake(1) manual page. it would be incorrect to not reference it, but the error message should educate the user as to the general nature of how to use the command in addition to still calling it an installable. it is confusing though to use installable to mean attrset of packages, i will say that, as normally it names one derivation.
as for the suggestion to mention the existing installables, this is not possible. if we were to dump those for flakes that would mean dumping the flake registry (which isn't even complete bc you could write github:nixos/nixpkgs also!), which is much too large to be useful to the user in an error message. see the output of nix registry list. also, because it does take an installable, you could write
-f '<nixpkgs>'
instead of flake stuff.all of this to say: you're right about it being confusing and a trivial rewording would help a lot, but it's a bit more nuanced as to how to actually do the rewording.