.. title: Nix Package Manager Cookbook .. slug: nix-package-manager-cookbook .. date: 2015-02-11 00:15:45 UTC .. tags: linux, nix, ubuntu .. category: .. link: .. description: .. type: text Nix Package Manager Cookbook =================================================== This is a cookbook containing a list of commands to perform frequent tasks in `Nix `_. Read the `Nix Package Manager Guide `_ for detailed information. .. TEASER_END: Read more Install Nix. :: user@host:~/Downloads$ curl -o install-nix.sh https://nixos.org/nix/install user@host:~/Downloads$ sh install-nix.sh You'll need to have sudo access for the script to create the /nix directory. The installer adds the relevant paths to your .profile. To activate them :: user@host:~$ . /home/YOURUSERNAME/.nix-profile/etc/profile.d/nix.sh Add to .bashrc if not already present in .profile. I just prefer to add it to .bashrc; your preference may vary. :: if [ -e /home/YOURUSERNAME/.nix-profile/etc/profile.d/nix.sh ]; then . /home/YOURUSERNAME/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer Search for available packages. :: user@host:~$ nix-env --query --available --status --description go user@host:~$ nix-env --query --available --status --description python user@host:~$ nix-env --query --available --status --description python3 user@host:~$ nix-env --query --available --status --description '.*virtualenv.*' List installed packages. :: user@host:~$ nix-env --query --installed Update Nix and then update all installed packages. :: user@host:~$ nix-channel --update user@host:~$ nix-env -u '*' Work with channels. Since I prefer bleeding edge packages I use the *nixpkgs-unstable* channel. :: user@host:~$ nix-channel --list user@host:~$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable user@host:~$ nix-channel --remove nixpkgs Install packages (derivatives). :: user@host:~$ nix-env -i pycharm-community-4.0.1 Uninstall package (derivative). :: user@host:~$ nix-env -e pycharm-community-4.0.1