Skip to content

Instantly share code, notes, and snippets.

@sjfloat
Last active July 29, 2021 04:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjfloat/7f5c7035f9850b41b9288dad2dd65d62 to your computer and use it in GitHub Desktop.
Save sjfloat/7f5c7035f9850b41b9288dad2dd65d62 to your computer and use it in GitHub Desktop.
port of nix.sh
set NIX_LINK="$HOME/.nix-profile"
# Set the default profile.
test -L "$NIX_LINK"
if ( $status != 0 ) then
echo "creating $NIX_LINK" >&2
set _NIX_DEF_LINK=/nix/var/nix/profiles/default
/nix/store/rznhi2hyzcgckk7yb2662lr57sb906ps-coreutils-8.24/bin/ln -s "$_NIX_DEF_LINK" "$NIX_LINK"
endif
setenv PATH $NIX_LINK/bin:$NIX_LINK/sbin:$PATH
# Subscribe the user to the Nixpkgs channel by default.
test -e $HOME/.nix-channels
if ( $status != 0 ) then
echo "https://nixos.org/channels/nixpkgs-unstable nixpkgs" > $HOME/.nix-channels
endif
# Append ~/.nix-defexpr/channels/nixpkgs to $NIX_PATH so that
# <nixpkgs> paths work when the user has fetched the Nixpkgs
# channel.
set nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs
if ( ! $?NIX_PATH ) then
setenv NIX_PATH $nixpkgs
else
setenv NIX_PATH ${NIX_PATH}:$nixpkgs
endif
# 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
setenv SSL_CERT_FILE /etc/ssl/certs/ca-certificates.crt
else if ( -e /etc/ssl/certs/ca-bundle.crt ) then # Old NixOS
setenv SSL_CERT_FILE /etc/ssl/certs/ca-bundle.crt
else if ( -e /etc/pki/tls/certs/ca-bundle.crt ) then # Fedora, CentOS
setenv SSL_CERT_FILE /etc/pki/tls/certs/ca-bundle.crt
else if ( -e "$NIX_LINK/etc/ssl/certs/ca-bundle.crt" ) then # fall back to cacert in Nix profile
setenv SSL_CERT_FILE "$NIX_LINK/etc/ssl/certs/ca-bundle.crt"
else if ( -e "$NIX_LINK/etc/ca-bundle.crt" ) then # old cacert in Nix profile
setenv SSL_CERT_FILE "$NIX_LINK/etc/ca-bundle.crt"
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment