Skip to content

Instantly share code, notes, and snippets.

@SG60
Last active January 17, 2022 08:58
Show Gist options
  • Select an option

  • Save SG60/832a5c0e119197d7539c to your computer and use it in GitHub Desktop.

Select an option

Save SG60/832a5c0e119197d7539c to your computer and use it in GitHub Desktop.
Nix path setup file for fish (based on the bash version)
if [ -n "$HOME" ]
set NIX_LINK "$HOME/.nix-profile"
# Set the default profile.
if not [ -L "$NIX_LINK" ]
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"
end
set -x PATH $NIX_LINK/bin $NIX_LINK/sbin $PATH
# Subscribe the user to the Nixpkgs channel by default.
if [ ! -e $HOME/.nix-channels ]
echo "https://nixos.org/channels/nixpkgs-unstable nixpkgs" > $HOME/.nix-channels
end
# Append ~/.nix-defexpr/channels/nixpkgs to $NIX_PATH so that
# <nixpkgs> paths work when the user has fetched the Nixpkgs
# channel.
set -x NIX_PATH (echo $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 ] # NixOS, Ubuntu, Debian, Gentoo, Arch
set -x SSL_CERT_FILE /etc/ssl/certs/ca-certificates.crt
else if [ -e /etc/ssl/certs/ca-bundle.crt ] # Old NixOS
set -x SSL_CERT_FILE /etc/ssl/certs/ca-bundle.crt
else if [ -e /etc/pki/tls/certs/ca-bundle.crt ] # Fedora, CentOS
set -x SSL_CERT_FILE /etc/pki/tls/certs/ca-bundle.crt
else if [ -e "$NIX_LINK/etc/ssl/certs/ca-bundle.crt" ] # fall back to cacert in Nix profile
set -x SSL_CERT_FILE "$NIX_LINK/etc/ssl/certs/ca-bundle.crt"
else if [ -e "$NIX_LINK/etc/ca-bundle.crt" ] # old cacert in Nix profile
set -x SSL_CERT_FILE "$NIX_LINK/etc/ca-bundle.crt"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment