From 8aafc553aeeb7383a0f9066540a5db27e1558876 Mon Sep 17 00:00:00 2001 From: lelgenio Date: Sat, 6 May 2023 22:03:42 -0300 Subject: [PATCH] buildFHSEnv: use default values as fallback for XDG_DATA_DIRS --- .../build-fhsenv-bubblewrap/buildFHSEnv.nix | 13 +++++++++++++ pkgs/build-support/build-fhsenv-chroot/env.nix | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix b/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix index 305a959a35dd..2d927c7df731 100644 --- a/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix +++ b/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix @@ -76,6 +76,19 @@ let # XDG_DATA_DIRS is used by pressure-vessel (steam proton) and vulkan loaders to find the corresponding icd export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}/run/opengl-driver/share:/run/opengl-driver-32/share + # Following XDG spec [1], XDG_DATA_DIRS should default to "/usr/local/share:/usr/share". + # In nix, it is commonly set without containing these values, so we add them as fallback. + # + # [1] + case ":$XDG_DATA_DIRS:" in + *:/usr/local/share:*) ;; + *) export XDG_DATA_DIRS="$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}/usr/local/share" ;; + esac + case ":$XDG_DATA_DIRS:" in + *:/usr/share:*) ;; + *) export XDG_DATA_DIRS="$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}/usr/share" ;; + esac + # Force compilers and other tools to look in default search paths unset NIX_ENFORCE_PURITY export NIX_CC_WRAPPER_TARGET_HOST_${stdenv.cc.suffixSalt}=1 diff --git a/pkgs/build-support/build-fhsenv-chroot/env.nix b/pkgs/build-support/build-fhsenv-chroot/env.nix index fbc50c2dc253..abc9ac4c026f 100644 --- a/pkgs/build-support/build-fhsenv-chroot/env.nix +++ b/pkgs/build-support/build-fhsenv-chroot/env.nix @@ -63,6 +63,19 @@ let # XDG_DATA_DIRS is used by pressure-vessel (steam proton) and vulkan loaders to find the corresponding icd export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}/run/opengl-driver/share:/run/opengl-driver-32/share + # Following XDG spec [1], XDG_DATA_DIRS should default to "/usr/local/share:/usr/share". + # In nix, it is commonly set without containing these values, so we add them as fallback. + # + # [1] + case ":$XDG_DATA_DIRS:" in + *:/usr/local/share:*) ;; + *) export XDG_DATA_DIRS="$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}/usr/local/share" ;; + esac + case ":$XDG_DATA_DIRS:" in + *:/usr/share:*) ;; + *) export XDG_DATA_DIRS="$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}/usr/share" ;; + esac + # Force compilers and other tools to look in default search paths unset NIX_ENFORCE_PURITY export NIX_CC_WRAPPER_TARGET_HOST_${stdenv.cc.suffixSalt}=1