Skip to content

Instantly share code, notes, and snippets.

@matthewbauer
Last active July 27, 2017 18:45
Show Gist options
  • Save matthewbauer/7e61f178ec8ae56f4241912506c9a64e to your computer and use it in GitHub Desktop.
Save matthewbauer/7e61f178ec8ae56f4241912506c9a64e to your computer and use it in GitHub Desktop.
# command-not-found support is now available
# for nixpkgs-unstable through nix-index
# install Nix (if you haven't already)
curl https://nixos.org/nix/install | sh
# install nix-index
nix-env -iA nixpkgs.nix-index
# generate the index (will take a little bit)
nix-index
# load command_not_found_handler for Bash
# and command_not_found_handle for Zsh
source $HOME/.nix-profile/etc/profile.d/command-not-found.sh
# try it out:
cowsay
# The program 'cowsay' is currently not installed. You can install it
# by typing:
# nix-env -iA nixpkgs.cowsay.out
nix-env -iA nixpkgs.cowsay.out
# installing ‘cowsay-3.03+dfsg1-16’
# these paths will be fetched (0.01 MiB download, 0.03 MiB unpacked):
# /nix/store/jqwlgxjz31mzl2zmz6fg1prvfsj2ya3v-cowsay-3.03+dfsg1-16
# fetching path ‘/nix/store/jqwlgxjz31mzl2zmz6fg1prvfsj2ya3v-cowsay-3.03+dfsg1-16’...
# *** Downloading ‘https://cache.nixos.org/nar/0hsls9ngbgd4kjacg47shcqmnjf790zmnv2w0bjkdppcrdgf928i.nar.xz’ to ‘/nix/store/jqwlgxjz31mzl2zmz6fg1prvfsj2ya3v-cowsay-3.03+dfsg1-16’...
# % Total % Received % Xferd Average Speed Time Time Time Current
# Dload Upload Total Spent Left Speed
# 100 9488 100 9488 0 0 23362 0 --:--:-- --:--:-- --:--:-- 23427
# building path(s) ‘/nix/store/80ig0a7rwy4a6qn7yigqac0f56swa8mj-user-environment’
# created 1389 symlinks in user environment
cowsay hello world
# _____________
# < hello world >
# -------------
# \ ^__^
# \ (oo)\_______
# (__)\ )\/\
# ||----w |
# || ||
# make command-not-found available on login
echo 'source $HOME/.nix-profile/etc/profile.d/command-not-found.sh' >> $HOME/.profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment