From 0f13cccb95523a0dacb58c47aeac2c1d86af75f8 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Wed, 11 Nov 2020 16:26:06 +0100 Subject: [PATCH] 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`. --- pkgs/stdenv/generic/setup.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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.