Skip to content

Instantly share code, notes, and snippets.

@elrzn
Last active October 9, 2015 13:58
Show Gist options
  • Save elrzn/0c04a9c5ff098911e97e to your computer and use it in GitHub Desktop.
Save elrzn/0c04a9c5ff098911e97e to your computer and use it in GitHub Desktop.
Notes on using the Nix Package Manager under OS X
# Nuke Homebrew :)
sudo rm -rf /opt/homebrew-cask
brew list | xargs brew uninstall --force
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
# Install Nix
curl https://nixos.org/nix/install | sh # :dance:
# Add the following lines at the end of your ~/.bash_profile, ~/.zshrc...
if [ -e /Users/$USER/.nix-profile/etc/profile.d/nix.sh ];
then . /Users/$USER/.nix-profile/etc/profile.d/nix.sh;
fi
export PATH="$PATH:/Users/$USER/.nix-profile/bin"
# Update Nix. Make sure to run this after installing...
nix-channel --update
# Now everything is ready!
# Some quick tips:
# Query for a package (git for example)
nix-env -qaP | grep git
# Install a package
nix-env -i git
# Go back to a previous generation
nix-env --list-generations
nix-env --switch-generation $NUMBER
# Quick rollback (revert to previous generation)
nix-env --rollback
# List installed packages
nix-env -q
# Update packages
nix-env -uA git curl emacs ...
nix-env -u # updates all
# Uninstalling packages
nix-env -e git-2.5.3
# Remove unuxed packages, etc.
nix-collect-garbage -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment