mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-25 09:28:27 +02:00
fix: conda init failed because ~/.zshrc not modifiable
This commit is contained in:
@@ -2,6 +2,23 @@ let
|
|||||||
envExtra = ''
|
envExtra = ''
|
||||||
export PATH="$PATH:/opt/homebrew/bin:/usr/local/bin"
|
export PATH="$PATH:/opt/homebrew/bin:/usr/local/bin"
|
||||||
'';
|
'';
|
||||||
|
initExtra = ''
|
||||||
|
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 {
|
in {
|
||||||
# Homebrew's default install location:
|
# Homebrew's default install location:
|
||||||
# /opt/homebrew for Apple Silicon
|
# /opt/homebrew for Apple Silicon
|
||||||
@@ -10,10 +27,10 @@ in {
|
|||||||
# in /opt/homebrew for Apple Silicon and /usr/local for Rosetta 2 to coexist and use bottles.
|
# in /opt/homebrew for Apple Silicon and /usr/local for Rosetta 2 to coexist and use bottles.
|
||||||
programs.bash = {
|
programs.bash = {
|
||||||
enable = true;
|
enable = true;
|
||||||
bashrcExtra = envExtra;
|
bashrcExtra = envExtra + initExtra;
|
||||||
};
|
};
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
inherit envExtra;
|
inherit envExtra initExtra;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user