Installing the Nix Package Manager

There isn’t really a reason to read my install directions for nix, I just used the default install command for Linux/Mac OS X.  To wit:

curl | sh

Except that I had to modify the .profile script to work in tcsh.  Namely, I created a version of the default file works for csh/tcsh:


if [ -n "$HOME" ]; then
  echo 'setenv NIX_LINK $HOME/.nix-profile;'

  # Set the default profile.
  if ! [ -L "$NIX_LINK" ]; then
    echo "creating $NIX_LINK" >&2
    /nix/store/rznhi2hyzcgckk7yb2662lr57sb906ps-coreutils-8.24/bin/ln -s "$_NIX_DEF_LINK" "$NIX_LINK"

  echo "setenv PATH ${NIX_LINK}/bin:${NIX_LINK}/sbin:$PATH;"
  # Subscribe the user to the Nixpkgs channel by default.
  if [ ! -e $HOME/.nix-channels ]; then
    echo " nixpkgs" > "$HOME/.nix-channels"

  # Append ~/.nix-defexpr/channels/nixpkgs to $NIX_PATH so that
  #  paths work when the user has fetched the Nixpkgs
  # channel.
  echo "setenv NIX_PATH ${NIX_PATH:+$NIX_PATH:}nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs;"

  # Set $SSL_CERT_FILE so that Nixpkgs applications like curl work.
  if [ -e /etc/ssl/certs/ca-certificates.crt ]; then # NixOS, Ubuntu, Debian, Gentoo, Arch
    echo 'setenv SSL_CERT_FILE /etc/ssl/certs/ca-certificates.crt;'
  elif [ -e /etc/ssl/certs/ca-bundle.crt ]; then # Old NixOS
    echo 'setenv SSL_CERT_FILE /etc/ssl/certs/ca-bundle.crt;'
  elif [ -e /etc/pki/tls/certs/ca-bundle.crt ]; then # Fedora, CentOS
    echo 'setenv SSL_CERT_FILE /etc/pki/tls/certs/ca-bundle.crt;'
  elif [ -e "$NIX_LINK/etc/ssl/certs/ca-bundle.crt" ]; then # fall back to cacert in Nix profile
    echo 'setenv SSL_CERT_FILE "$NIX_LINK/etc/ssl/certs/ca-bundle.crt";'
  elif [ -e "$NIX_LINK/etc/ca-bundle.crt" ]; then # old cacert in Nix profile
    echo 'setenv SSL_CERT_FILE "$NIX_LINK/etc/ca-bundle.crt";'

I installed this file as: /nix/var/nix/profiles/default/etc/profile.d/nix.csh. Then I just called in my .tcshrc using:

eval `/nix/var/nix/profiles/default/etc/profile.d/nix.csh`