nmattia / niv

Easy dependency management for Nix projects
https://github.com/nmattia/niv
MIT License
1.55k stars 77 forks source link

Implementation and proposal of `niv search` command #293

Open kamadorueda opened 3 years ago

kamadorueda commented 3 years ago

As you may know there is no native way to know which nixpkgs commit should I install in order to have older versions of a package. This is because nix-env -qa usually offers 1 version (the latest). More about it here

So I think it would be awesome to embed into niv search the Nixpkgs database so users can find all versions associated to a package and then add it to their projects easily, for instance $ niv search niv can display information similar to this: https://kamadorueda.github.io/nixpkgs-db/#/pkg/niv (or display into console the data). The experience is up to us, please see below.

What I imagine is the best user experience possible is:

$ niv search awscli

4 matching packages found:

0. awscli
1. awscli2
2. python27Packages.awscli
3. ....

Which package do you want to inspect? Please type the number
> 0

Available versions:

0. 1.9.6
1. 1.9.12
2. 1.7.47
3. ....

Which version do you want to install? Please type the number
> 1

Installing awscli @ 1.9.12

Done!

I can work on an HTTP API at Nixpkgs Database that outputs JSON documents so Niv can consume it, I can also work on the niv-search command (although it may be faster if you guys work on this part as you know better the project)

Let me know your thoughts !

nmattia commented 3 years ago

Hey! I think that's a great idea, though niv might not be the best place, since it doesn't deal with nixpkgs at all. What about creating a new executable?

This is great! You should advertise this more!