Skip to content

Instantly share code, notes, and snippets.

@mbbx6spp
Last active April 15, 2019 11:21
Show Gist options
  • Save mbbx6spp/c42071f19a78709c1c7715a0786b07a7 to your computer and use it in GitHub Desktop.
Save mbbx6spp/c42071f19a78709c1c7715a0786b07a7 to your computer and use it in GitHub Desktop.
Since people were asking about it from my tweet. This is just a simple wrapper I use.
#!/usr/bin/env bash
if nix-env --version >/dev/null 2>&1; then
function main() {
env PAGER=cat nix-env -qaP --description $*
}
set -eu
set -o pipefail
main $*
else
>&2 echo "Error: no Nix is installed in your PATH. What bullshit is this?"
echo "PATH=${PATH}"
exit 1
fi

nix-query usage

$ nix-query gifsicl
error: selector ‘gifsicl’ matches no derivations
?=1 | Error

$ nix-query gifsicle
nixos.gifsicle  gifsicle-1.88  Command-line tool for creating, editing, and getting information about GIF images and animations
?=0 | OK

$ nix-query gifsicl.*
nixos.gifsicle  gifsicle-1.88  Command-line tool for creating, editing, and getting information about GIF images and animations
?=0 | OK

$ nix-query gif.*
nixos.giflib_4_1  giflib-4.1.6
nixos.giflib_5_0  giflib-5.0.6   A library for reading and writing gif images
nixos.giflib      giflib-5.1.4   A library for reading and writing gif images
nixos.gifsicle    gifsicle-1.88  Command-line tool for creating, editing, and getting information about GIF images and animations
?=0 | OK

$ nix-query -A nixos.haskellPackages | wc -l
10406
?=0 | OK

[nix-shell:~/src/dailykos/dailykos]$ nix-query -A nixos.vimPlugins | head -6
nixos.vimPlugins.pluginnames2nix                 vim-plugin-names-to-nix
nixos.vimPlugins.a-vim                           vimplugin-a-vim-2010-11-06
nixos.vimPlugins.align                           vimplugin-align-2012-08-07
nixos.vimPlugins.calendar                        vimplugin-calendar-vim-2016-07-18
nixos.vimPlugins.changeColorScheme-vim           vimplugin-changeColorScheme-vim-2010-10-17
nixos.vimPlugins.CheckAttach                     vimplugin-CheckAttach-2015-06-22

Related Tools

This script wrapper predates nox which is worth checking out now: https://github.com/madjar/nox

HTH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment