Install/Uninstall instructions #

Install with:

sh <(curl --darwin-use-unencrypted-nix-store-volume

To uninstall:

  1. Remove the entry from fstab using sudo vifs
  2. Destroy the data volume using diskutil apfs deleteVolume
  3. Remove the nix line from /etc/synthetic.conf or the file

Resources #

Aliases #

alias nix-env-search="nix-env -qaP"
alias nix-env-install="nix-env -iA"
alias nix-env-update-all="nix-channel --update nixpkgs && nix-env -u '*'"
alias nix-up="nix-env -u"
alias nix-gc="nix-collect-garbage -d"

Nix-env Cheatsheet #

List installed packages:

nix-env --query --installed

To search for packages:

To install a certain package:

nix-env -iA nixpkgs.ripgrep


nix-env -e tree ripgrep

List generations (all of the different versions of the nix-env profile):

nix-env --list-generations

To rollback to a previous version of the profile:

nix-env --rollback

Or pick a specific generation:

nix-env --switch-generation 2

To use a program without installing it, we can create a temporary environment with nix-shell (in this case tectonic is the name of the package we want):

nix-shell '<nixpkgs>' -A tectonic

To update all packages:

nix-channel --update nixpkgs
nix-env -u '*'

Nix-shell Cheatsheet #

To enable nix-shell for a project, define a default.nix in the project’s root, like so:

# This imports the nix package collection,
# so we can access the `pkgs` and `stdenv` variables
with import <nixpkgs> {};

# Make a new "derivation" that represents our shell
stdenv.mkDerivation {
  name = "fpinscala-courses";

  # The packages in the `buildInputs` list will be added to the PATH in our shell
  buildInputs = [
    # see to search for more

Then execute nix-shell in the directory.