mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-01-11 14:20:23 +01:00
40 lines
1.2 KiB
Nix
40 lines
1.2 KiB
Nix
{ lib, ... }:
|
|
let
|
|
envExtra = ''
|
|
export PATH="$PATH:/opt/homebrew/bin:/usr/local/bin"
|
|
'';
|
|
# copied from the content generated by `conda init bash`
|
|
initContent = ''
|
|
arch=$(uname -m)
|
|
|
|
if [ "aarch64" = "$arch" ] || [ "arm64" = "$arch" ]; then
|
|
# >>> (miniforge)conda initialize >>>
|
|
# !! Contents within this block are managed by 'conda init' !!
|
|
if [ -f "/opt/homebrew/Caskroom/miniforge/base/etc/profile.d/conda.sh" ]; then
|
|
. "/opt/homebrew/Caskroom/miniforge/base/etc/profile.d/conda.sh"
|
|
else
|
|
export PATH="/opt/homebrew/Caskroom/miniforge/base/bin:$PATH"
|
|
fi
|
|
# <<< conda initialize <<<
|
|
elif [[ "x86_64" = "$arch" ]]; then
|
|
# do nothing
|
|
true
|
|
fi
|
|
'';
|
|
in
|
|
{
|
|
# Homebrew's default install location:
|
|
# /opt/homebrew for Apple Silicon
|
|
# /usr/local for macOS Intel
|
|
# The prefix /opt/homebrew was chosen to allow installations
|
|
# in /opt/homebrew for Apple Silicon and /usr/local for Rosetta 2 to coexist and use bottles.
|
|
programs.bash = {
|
|
enable = true;
|
|
bashrcExtra = lib.mkAfter (envExtra + initContent);
|
|
};
|
|
programs.zsh = {
|
|
enable = true;
|
|
inherit envExtra initContent;
|
|
};
|
|
}
|