I am using the package manager Nix as a replacement for Homebrew on MacOS and also as my preferred package manager on Linux systems. The main benefit is that the same tool and the same package set can be used both on Linux and MacOS.
Although it has a built-in query mechanism, I found that having a text file with all packages together with the tool less is all I need for a pretty nice workflow to find packages.
Querying for a package
The tool nix-env can be used to query for available packages. The following code block shows how to search for Emacs:
$ nix-env -qaP emacs nixpkgs.emacs emacs-24.5 nixpkgs.emacs24Macport emacs-24.5-mac-5.15 nixpkgs.emacs25pre emacs-25.1-rc2
I prefer to use the attribute names in the left column when installing, the switch -P ensures that they are included in the output. I would now install emacs with the following command into my user environment:
nix-env -iA nixpkgs.emacs
Generate the list of all packages
For the regular use I found that having a text file with a list of all packages is more convenient for me. It can be generated with the following command:
nix-env -qaP > ~/all
This list is basically a two column text file, in the first column we see the attribute names and in the second column we see the derivation name:
$ head ~/all nixpkgs.zeroad 0ad-0.0.20 nixpkgs.2048-in-terminal 2048-in-terminal-2015-01-15 nixpkgs.389-ds-base 389-ds-base-1.3.3.9 nixpkgs.pong3d 3dpong-0.5 nixpkgs.rdf4store 4store-1.1.6 nixpkgs.tiny8086 8086tiny-1.25 nixpkgs.90secondportraits 90secondportraits-1.01b nixpkgs._915resolution 915resolution-0.5.2 nixpkgs._9pfs 9pfs nixpkgs.a2jmidid a2jmidid-8
Use it via less
In my case I like to keep it around as ~/all in my home folder, so that I can query it with less easily:
less ~/all
Comments
comments powered by Disqus