forked from lix-project/lix
Merge pull request #7547 from alxthm/fish-support-older-versions
Fix Nix installation on older versions of fish
This commit is contained in:
commit
cc02e11967
|
@ -1,3 +1,15 @@
|
||||||
|
function add_path --argument-names new_path
|
||||||
|
if type -q fish_add_path
|
||||||
|
# fish 3.2.0 or newer
|
||||||
|
fish_add_path --prepend --global $new_path
|
||||||
|
else
|
||||||
|
# older versions of fish
|
||||||
|
if not contains $new_path $fish_user_paths
|
||||||
|
set --global fish_user_paths $new_path $fish_user_paths
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Only execute this file once per shell.
|
# Only execute this file once per shell.
|
||||||
if test -n "$__ETC_PROFILE_NIX_SOURCED"
|
if test -n "$__ETC_PROFILE_NIX_SOURCED"
|
||||||
exit
|
exit
|
||||||
|
@ -31,5 +43,7 @@ else
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
fish_add_path --prepend --global "@localstatedir@/nix/profiles/default/bin"
|
add_path "@localstatedir@/nix/profiles/default/bin"
|
||||||
fish_add_path --prepend --global "$HOME/.nix-profile/bin"
|
add_path "$HOME/.nix-profile/bin"
|
||||||
|
|
||||||
|
functions -e add_path
|
||||||
|
|
|
@ -1,3 +1,15 @@
|
||||||
|
function add_path --argument-names new_path
|
||||||
|
if type -q fish_add_path
|
||||||
|
# fish 3.2.0 or newer
|
||||||
|
fish_add_path --prepend --global $new_path
|
||||||
|
else
|
||||||
|
# older versions of fish
|
||||||
|
if not contains $new_path $fish_user_paths
|
||||||
|
set --global fish_user_paths $new_path $fish_user_paths
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if test -n "$HOME" && test -n "$USER"
|
if test -n "$HOME" && test -n "$USER"
|
||||||
|
|
||||||
# Set up the per-user profile.
|
# Set up the per-user profile.
|
||||||
|
@ -32,6 +44,8 @@ if test -n "$HOME" && test -n "$USER"
|
||||||
set --export --prepend --path MANPATH "$NIX_LINK/share/man"
|
set --export --prepend --path MANPATH "$NIX_LINK/share/man"
|
||||||
end
|
end
|
||||||
|
|
||||||
fish_add_path --prepend --global "$NIX_LINK/bin"
|
add_path "$NIX_LINK/bin"
|
||||||
set --erase NIX_LINK
|
set --erase NIX_LINK
|
||||||
end
|
end
|
||||||
|
|
||||||
|
functions -e add_path
|
||||||
|
|
Loading…
Reference in a new issue