summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2020-11-11 16:26:06 +0100
committerJonathan Ringer <jonringer@users.noreply.github.com>2020-11-25 08:44:04 -0800
commit0f13cccb95523a0dacb58c47aeac2c1d86af75f8 (patch)
tree87128887e062df7a7dde914250d89c7f1405c9d5
parent5b286eaf20e0d10b37bfcd58518612b4203eceda (diff)
setup.sh: Support XDG_DATA_DIRS
XDG_DATA_DIRS is to /share as PATH is to /bin. It was defined as part of the XDG basedir specification. https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html While it originated from the X Desktop Group, it is not limited to the X11 ecosystem, as evidenced by its use in bash-completion. The removal of ` && -d "$pkg/bin"` is ok, because this optimization is already performed by `addToSearchPath`.
-rw-r--r--pkgs/stdenv/generic/setup.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index 2617a8f74ab5..34405b048ecb 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -483,8 +483,9 @@ activatePackage() {
# the transition, we do include everything in thatcase.
#
# TODO(@Ericson2314): Don't special-case native compilation
- if [[ ( -z "${strictDeps-}" || "$hostOffset" -le -1 ) && -d "$pkg/bin" ]]; then
+ if [[ -z "${strictDeps-}" || "$hostOffset" -le -1 ]]; then
addToSearchPath _PATH "$pkg/bin"
+ addToSearchPath _XDG_DATA_DIRS "$pkg/share"
fi
if [[ "$hostOffset" -eq 0 && -d "$pkg/bin" ]]; then
@@ -602,13 +603,16 @@ fi
PATH="${_PATH-}${_PATH:+${PATH:+:}}$PATH"
HOST_PATH="${_HOST_PATH-}${_HOST_PATH:+${HOST_PATH:+:}}$HOST_PATH"
+XDG_DATA_DIRS="${_XDG_DATA_DIRS-}${_XDG_DATA_DIRS:+${XDG_DATA_DIRS:+:}}${XDG_DATA_DIRS-}"
if (( "${NIX_DEBUG:-0}" >= 1 )); then
echo "final path: $PATH"
echo "final host path: $HOST_PATH"
+ echo "final data dirs: $XDG_DATA_DIRS"
fi
unset _PATH
unset _HOST_PATH
+unset _XDG_DATA_DIRS
# Make GNU Make produce nested output.