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

Add --search option to nix-env #293

Closed
wants to merge 1 commit into from
Closed

Conversation

tailhook
Copy link
Contributor

The option does substring search on name, attribute name, and meta-description for all the words specified on command-line. So for example nix-env -qa --search python amqp gives you expected result.

I believe it should have short alias, but I'm not sure which one. Both -S and -s are used. May be -F (i.e. find or filter)

@tailhook tailhook changed the title Add --search option Add --search option to nix-env Jun 28, 2014
@vcunat
Copy link
Member

vcunat commented Jun 28, 2014

BTW, from user experience, this won't be too efficient. What do you think e.g. about providing channels with (sqlite) DB containing index for such searches? (I mean using these indices for -i/-q without -A, too.)

@vcunat
Copy link
Member

vcunat commented Jun 28, 2014

... also, search/installation by executable name might also be nice, for which we already do have the command-not-found DB.

@tailhook
Copy link
Contributor Author

@vcunat, it works in 2 seconds for me. Which is not bad at all. I'm not sure sqlite db would be useful or not, but at least that would not work for nix-env -f.

Can you point me to the implementation of command-not-found DB? So I can take a look. But It is separate pull request anyway.

@vcunat
Copy link
Member

vcunat commented Jun 28, 2014

Well, on cold cache just reading the whole nixpkgs tree takes much longer, at least with my slow 5400-rpm notebook HDD (and maybe slightly fragmented tree). But I guess it might not be currently efficient to spend time on such enhancements.

I only remember that command-not-found uses an sqlite DB distributed with the channel. I've never seen the implementation.

@lheckemann
Copy link
Member

lheckemann commented Jan 1, 2017

I guess this is to some extent obsoleted by the existence of the nox tool which provides a much better UX for searching in general?

@tailhook
Copy link
Contributor Author

tailhook commented Jan 1, 2017

@lheckemann, well, I'd better prefer this solution, because:

  1. nox "python amqp", shows me nothing, while nix-env -qaP | grep python | grep amqp | wc -l yields 16 (which means nix-env --search python amqp would work too)
  2. nox is 3x slower when there is no cache (and I use it so rarely that there is always no cache)
  3. nox python | grep amqp yields some garbage. I.e. nox can be used only interactively.
  4. And it's yet another tool comparing to just 50 lines of code that does job well

So while was lazy to update this patch it's still good to have. And I would stop using nox if this patch is applied (because I don't feel comfortable with interactivity of nox). On the other hand, nobody was interested in this for two years....

@vcunat
Copy link
Member

vcunat commented Jan 1, 2017

Side-note: there's also this newly-developed nix command. (In any case, I do not have push access here.)

@lheckemann
Copy link
Member

We have nix search now, so I guess there's no point in this one?

@edolstra
Copy link
Member

Indeed.

@edolstra edolstra closed this Apr 19, 2018
zolodev pushed a commit to zolodev/nix that referenced this pull request Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants