diff --git a/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix/default.nix b/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix/default.nix index 0a9765549b633..547e82c0294cf 100644 --- a/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix/default.nix +++ b/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix/default.nix @@ -92,7 +92,7 @@ buildPythonPackage { dontPatchShebangs = true; postFixup = '' - addToSearchPath program_PYTHONPATH $out/${python.sitePackages} + appendToSearchPath program_PYTHONPATH $out/${python.sitePackages} patchPythonScript $out/share/matrix.py substituteInPlace $out/${python.sitePackages}/matrix/server.py --replace-fail \"matrix_sso_helper\" \"$out/bin/matrix_sso_helper\" substituteInPlace $out/${python.sitePackages}/matrix/uploads.py --replace-fail \"matrix_upload\" \"$out/bin/matrix_upload\" diff --git a/pkgs/applications/science/math/R/setup-hook.sh b/pkgs/applications/science/math/R/setup-hook.sh index 6951e2a4b61bd..d0d2299ba33c1 100644 --- a/pkgs/applications/science/math/R/setup-hook.sh +++ b/pkgs/applications/science/math/R/setup-hook.sh @@ -1,6 +1,6 @@ addRLibPath () { if [[ -d "$1/library" ]]; then - addToSearchPath R_LIBS_SITE "$1/library" + appendToSearchPath R_LIBS_SITE "$1/library" fi } diff --git a/pkgs/applications/version-management/mercurial/default.nix b/pkgs/applications/version-management/mercurial/default.nix index b01036d2292ec..239da484cdc62 100644 --- a/pkgs/applications/version-management/mercurial/default.nix +++ b/pkgs/applications/version-management/mercurial/default.nix @@ -190,7 +190,7 @@ let meta.broken = !stdenv.hostPlatform.isLinux || stdenv.buildPlatform != stdenv.hostPlatform; } '' - addToSearchPathWithCustomDelimiter : PYTHONPATH "${mercurial}/${python.sitePackages}" + appendToSearchPathWithCustomDelimiter : PYTHONPATH "${mercurial}/${python.sitePackages}" unpackPhase cd "$sourceRoot" diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index fdf3fcfb284d0..efb951ff3709d 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -106,6 +106,7 @@ let bintools_bin = optionalString (!nativeTools) (getBin bintools); # The wrapper scripts use 'cat' and 'grep', so we may need coreutils. coreutils_bin = optionalString (!nativeTools) (getBin coreutils); + gnugrep_bin = optionalString (!nativeTools) (getBin gnugrep); # See description in cc-wrapper. suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config @@ -155,6 +156,7 @@ stdenvNoCC.mkDerivation { passthru = { inherit targetPrefix suffixSalt; inherit bintools libc nativeTools nativeLibc nativePrefix isGNU isLLVM; + inherit libc_bin libc_dev libc_lib; emacsBufferSetup = pkgs: '' ; We should handle propagation here too @@ -198,7 +200,7 @@ stdenvNoCC.mkDerivation { ldPath="${nativePrefix}/bin" '' else '' - echo $bintools_bin > $out/nix-support/orig-bintools + echo ${bintools_bin} > $out/nix-support/orig-bintools ldPath="${bintools_bin}/bin" '' @@ -242,6 +244,7 @@ stdenvNoCC.mkDerivation { ''; strictDeps = true; + propagatedBuildInputs = [ bintools_bin libc_bin coreutils_bin gnugrep_bin ]; depsTargetTargetPropagated = extraPackages; setupHooks = [ @@ -303,7 +306,7 @@ stdenvNoCC.mkDerivation { # install the wrapper, you get tools like objdump (same for any # binaries of libc). + optionalString (!nativeTools) '' - printWords ${bintools_bin} ${optionalString (libc != null) libc_bin} > $out/nix-support/propagated-user-env-packages + printWords ${bintools_bin} ${libc_bin} > $out/nix-support/propagated-user-env-packages '' ## @@ -340,7 +343,7 @@ stdenvNoCC.mkDerivation { + optionalString (libc != null && targetPlatform.isAvr) '' for isa in avr5 avr3 avr4 avr6 avr25 avr31 avr35 avr51 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 tiny-stack; do - echo "-L${getLib libc}/avr/lib/$isa" >> $out/nix-support/libc-cflags + echo "-L${libc_lib}/avr/lib/$isa" >> $out/nix-support/libc-cflags done '' @@ -401,13 +404,11 @@ stdenvNoCC.mkDerivation { # TODO(@sternenseemann): invent something cleaner than passing in "" in case of absence expandResponseParams = "${expand-response-params}/bin/expand-response-params"; # TODO(@sternenseemann): rename env var via stdenv rebuild - shell = (getBin runtimeShell + runtimeShell.shellPath or ""); - gnugrep_bin = optionalString (!nativeTools) gnugrep; + shell = getBin runtimeShell + runtimeShell.shellPath or ""; rm = if nativeTools then "rm" else lib.getExe' coreutils "rm"; mktemp = if nativeTools then "mktemp" else lib.getExe' coreutils "mktemp"; wrapperName = "BINTOOLS_WRAPPER"; - inherit dynamicLinker targetPrefix suffixSalt coreutils_bin; - inherit bintools_bin libc_bin libc_dev libc_lib; + inherit dynamicLinker targetPrefix suffixSalt; default_hardening_flags_str = builtins.toString defaultHardeningFlags; } // lib.mapAttrs (_: lib.optionalString targetPlatform.isDarwin) { # These will become empty strings when not targeting Darwin. diff --git a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh index 944e45edac1bc..8dc8b27bf2257 100644 --- a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh +++ b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh @@ -8,12 +8,6 @@ fi path_backup="$PATH" -# phase separation makes this look useless -# shellcheck disable=SC2157 -if [ -n "@coreutils_bin@" ]; then - PATH="@coreutils_bin@/bin" -fi - source @out@/nix-support/utils.bash source @out@/nix-support/darwin-sdk-setup.bash diff --git a/pkgs/build-support/bintools-wrapper/setup-hook.sh b/pkgs/build-support/bintools-wrapper/setup-hook.sh index c146cbea80e4f..e9400e146b2f9 100644 --- a/pkgs/build-support/bintools-wrapper/setup-hook.sh +++ b/pkgs/build-support/bintools-wrapper/setup-hook.sh @@ -35,21 +35,6 @@ getTargetRoleWrapper addEnvHooks "$targetOffset" bintoolsWrapper_addLDVars -# shellcheck disable=SC2157 -if [ -n "@bintools_bin@" ]; then - addToSearchPath _PATH @bintools_bin@/bin -fi - -# shellcheck disable=SC2157 -if [ -n "@libc_bin@" ]; then - addToSearchPath _PATH @libc_bin@/bin -fi - -# shellcheck disable=SC2157 -if [ -n "@coreutils_bin@" ]; then - addToSearchPath _PATH @coreutils_bin@/bin -fi - # Export tool environment variables so various build systems use the right ones. export NIX_BINTOOLS${role_post}=@out@ diff --git a/pkgs/build-support/cc-wrapper/add-flags.sh b/pkgs/build-support/cc-wrapper/add-flags.sh index 2c3dc8884023b..694c94805b145 100644 --- a/pkgs/build-support/cc-wrapper/add-flags.sh +++ b/pkgs/build-support/cc-wrapper/add-flags.sh @@ -29,8 +29,8 @@ done # Arocc does not support "-B" if [[ -z "@isArocc@" ]]; then - # `-B@bintools@/bin' forces cc to use ld-wrapper.sh when calling ld. - NIX_CFLAGS_COMPILE_@suffixSalt@="-B@bintools@/bin/ $NIX_CFLAGS_COMPILE_@suffixSalt@" + # `-B@bintools_bin@/bin' forces cc to use ld-wrapper.sh when calling ld. + NIX_CFLAGS_COMPILE_@suffixSalt@="-B@bintools_bin@/bin/ $NIX_CFLAGS_COMPILE_@suffixSalt@" fi # Export and assign separately in order that a failing $(..) will fail diff --git a/pkgs/build-support/cc-wrapper/cc-wrapper.sh b/pkgs/build-support/cc-wrapper/cc-wrapper.sh index a6120931381e5..fc2a60022a049 100644 --- a/pkgs/build-support/cc-wrapper/cc-wrapper.sh +++ b/pkgs/build-support/cc-wrapper/cc-wrapper.sh @@ -8,13 +8,6 @@ fi path_backup="$PATH" -# That @-vars are substituted separately from bash evaluation makes -# shellcheck think this, and others like it, are useless conditionals. -# shellcheck disable=SC2157 -if [[ -n "@coreutils_bin@" && -n "@gnugrep_bin@" ]]; then - PATH="@coreutils_bin@/bin:@gnugrep_bin@/bin" -fi - source @out@/nix-support/utils.bash source @out@/nix-support/darwin-sdk-setup.bash diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index eadcd5bf0bcce..c1b684f47d764 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -104,11 +104,13 @@ let libc_bin = optionalString (libc != null) (getBin libc); libc_dev = optionalString (libc != null) (getDev libc); libc_lib = optionalString (libc != null) (getLib libc); + bintools_bin = optionalString (!nativeTools) (getBin bintools); cc_solib = getLib cc + optionalString (targetPlatform != hostPlatform) "/${targetPlatform.config}"; # The wrapper scripts use 'cat' and 'grep', so we may need coreutils. coreutils_bin = optionalString (!nativeTools) (getBin coreutils); + gnugrep_bin = optionalString (!nativeTools) (getBin gnugrep); # The "suffix salt" is a arbitrary string added in the end of env vars # defined by cc-wrapper's hooks so that multiple cc-wrappers can be used @@ -319,6 +321,7 @@ stdenvNoCC.mkDerivation { # unused middle-ground name that evokes both. inherit bintools; inherit cc libc libcxx nativeTools nativeLibc nativePrefix isGNU isClang isZig; + inherit libc_bin libc_dev libc_lib; emacsBufferSetup = pkgs: '' ; We should handle propagation here too @@ -372,14 +375,14 @@ stdenvNoCC.mkDerivation { ccPath="${if targetPlatform.isDarwin then cc else nativePrefix}/bin" '' else '' - echo $cc > $out/nix-support/orig-cc + echo ${cc} > $out/nix-support/orig-cc ccPath="${cc}/bin" '') # Create symlinks to everything in the bintools wrapper. + '' - for bbin in $bintools/bin/*; do + for bbin in ${bintools_bin}/bin/*; do mkdir -p "$out/bin" ln -s "$bbin" "$out/bin/$(basename $bbin)" done @@ -460,8 +463,14 @@ stdenvNoCC.mkDerivation { ''; strictDeps = true; - propagatedBuildInputs = [ bintools ] ++ extraTools ++ optionals cc.langD or cc.langJava or false [ zlib ]; - depsTargetTargetPropagated = optional (libcxx != null) libcxx ++ extraPackages; + propagatedBuildInputs = [ + coreutils_bin + libc_bin + bintools_bin + gnugrep_bin + ] ++ extraTools + ++ optionals cc.langD or cc.langJava or false [ zlib ]; + depsTargetTargetPropagated = [cc] ++ optional (libc != null) libc ++ optional (libcxx != null) libcxx ++ extraPackages; setupHooks = [ ../setup-hooks/role.bash @@ -471,9 +480,9 @@ stdenvNoCC.mkDerivation { name = "win-dll-hook.sh"; dontUnpack = true; installPhase = '' - echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib" > $out - echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib64" >> $out - echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib32" >> $out + echo appendToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib" > $out + echo appendToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib64" >> $out + echo appendToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib32" >> $out ''; }); @@ -491,11 +500,11 @@ stdenvNoCC.mkDerivation { # TODO(@Ericson2314): Remove this after stable release and force # everyone to refer to bintools-wrapper directly. + optionalString (!isArocc) '' - if [[ -f "$bintools/nix-support/dynamic-linker" ]]; then - ln -s "$bintools/nix-support/dynamic-linker" "$out/nix-support" + if [[ -f "${bintools}/nix-support/dynamic-linker" ]]; then + ln -s "${bintools}/nix-support/dynamic-linker" "$out/nix-support" fi - if [[ -f "$bintools/nix-support/dynamic-linker-m32" ]]; then - ln -s "$bintools/nix-support/dynamic-linker-m32" "$out/nix-support" + if [[ -f "${bintools}/nix-support/dynamic-linker-m32" ]]; then + ln -s "${bintools}/nix-support/dynamic-linker-m32" "$out/nix-support" fi '' @@ -624,7 +633,7 @@ stdenvNoCC.mkDerivation { '' + optionalString (cc.langAda or false && !isArocc) '' touch "$out/nix-support/gnat-cflags" touch "$out/nix-support/gnat-ldflags" - basePath=$(echo $cc/lib/*/*/*) + basePath=$(echo ${cc}/lib/*/*/*) ccCFlags+=" -B$basePath -I$basePath/adainclude" gnatCFlags="-I$basePath/adainclude -I$basePath/adalib" @@ -699,7 +708,7 @@ stdenvNoCC.mkDerivation { + optionalString (libc != null && targetPlatform.isAvr && !isArocc) '' for isa in avr5 avr3 avr4 avr6 avr25 avr31 avr35 avr51 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 tiny-stack; do - echo "-B${getLib libc}/avr/lib/$isa" >> $out/nix-support/libc-crt1-cflags + echo "-B${libc_lib}/avr/lib/$isa" >> $out/nix-support/libc-crt1-cflags done '' @@ -753,15 +762,12 @@ stdenvNoCC.mkDerivation { expandResponseParams = lib.optionalString (expand-response-params != "") (lib.getExe expand-response-params); # TODO(@sternenseemann): rename env var via stdenv rebuild shell = getBin runtimeShell + runtimeShell.shellPath or ""; - gnugrep_bin = optionalString (!nativeTools) gnugrep; rm = if nativeTools then "rm" else lib.getExe' coreutils "rm"; mktemp = if nativeTools then "mktemp" else lib.getExe' coreutils "mktemp"; - # stdenv.cc.cc should not be null and we have nothing better for now. - # if the native impure bootstrap is gotten rid of this can become `inherit cc;` again. - cc = optionalString (!nativeTools) cc; wrapperName = "CC_WRAPPER"; - inherit suffixSalt coreutils_bin bintools; - inherit libc_bin libc_dev libc_lib; + bintools = optionalString (!nativeTools) bintools; + inherit bintools_bin; + inherit suffixSalt; inherit darwinPlatformForCC; default_hardening_flags_str = builtins.toString defaultHardeningFlags; } // lib.mapAttrs (_: lib.optionalString targetPlatform.isDarwin) { diff --git a/pkgs/build-support/cc-wrapper/gnat-wrapper.sh b/pkgs/build-support/cc-wrapper/gnat-wrapper.sh index e75eb3eb1ebf6..e896c53d11024 100644 --- a/pkgs/build-support/cc-wrapper/gnat-wrapper.sh +++ b/pkgs/build-support/cc-wrapper/gnat-wrapper.sh @@ -8,13 +8,6 @@ fi path_backup="$PATH" -# That @-vars are substituted separately from bash evaluation makes -# shellcheck think this, and others like it, are useless conditionals. -# shellcheck disable=SC2157 -if [[ -n "@coreutils_bin@" && -n "@gnugrep_bin@" ]]; then - PATH="@coreutils_bin@/bin:@gnugrep_bin@/bin" -fi - cInclude=0 source @out@/nix-support/utils.bash diff --git a/pkgs/build-support/cc-wrapper/setup-hook.sh b/pkgs/build-support/cc-wrapper/setup-hook.sh index 33a2b62a49b00..c75b0a4140420 100644 --- a/pkgs/build-support/cc-wrapper/setup-hook.sh +++ b/pkgs/build-support/cc-wrapper/setup-hook.sh @@ -85,24 +85,6 @@ getTargetRoleWrapper # sort of deps (those with that offset). addEnvHooks "$targetOffset" ccWrapper_addCVars -# Note 1: these come *after* $out in the PATH (see setup.sh). -# Note 2: phase separation makes this look useless to shellcheck. - -# shellcheck disable=SC2157 -if [ -n "@cc@" ]; then - addToSearchPath _PATH @cc@/bin -fi - -# shellcheck disable=SC2157 -if [ -n "@libc_bin@" ]; then - addToSearchPath _PATH @libc_bin@/bin -fi - -# shellcheck disable=SC2157 -if [ -n "@coreutils_bin@" ]; then - addToSearchPath _PATH @coreutils_bin@/bin -fi - # Export tool environment variables so various build systems use the right ones. export NIX_CC${role_post}=@out@ diff --git a/pkgs/build-support/dart/build-dart-application/hooks/dart-fixup-hook.sh b/pkgs/build-support/dart/build-dart-application/hooks/dart-fixup-hook.sh index 60bd74871c92f..1a89574836609 100644 --- a/pkgs/build-support/dart/build-dart-application/hooks/dart-fixup-hook.sh +++ b/pkgs/build-support/dart/build-dart-application/hooks/dart-fixup-hook.sh @@ -12,7 +12,7 @@ dartFixupHook() { # which is not what application authors expect. APPLICATION_LD_LIBRARY_PATH="" for runtimeDependency in "${runtimeDependencies[@]}"; do - addToSearchPath APPLICATION_LD_LIBRARY_PATH "${runtimeDependency}/lib" + appendToSearchPath APPLICATION_LD_LIBRARY_PATH "${runtimeDependency}/lib" done if [[ ! -z "$APPLICATION_LD_LIBRARY_PATH" ]]; then wrapProgramArgs+=(--suffix LD_LIBRARY_PATH : \"$APPLICATION_LD_LIBRARY_PATH\") diff --git a/pkgs/build-support/pkg-config-wrapper/setup-hook.sh b/pkgs/build-support/pkg-config-wrapper/setup-hook.sh index 34f1a999a82ee..38df03a1516f1 100644 --- a/pkgs/build-support/pkg-config-wrapper/setup-hook.sh +++ b/pkgs/build-support/pkg-config-wrapper/setup-hook.sh @@ -13,8 +13,8 @@ pkgConfigWrapper_addPkgConfigPath () { local role_post getHostRoleEnvHook - addToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/lib/pkgconfig" - addToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/share/pkgconfig" + appendToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/lib/pkgconfig" + appendToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/share/pkgconfig" } # See ../setup-hooks/role.bash diff --git a/pkgs/build-support/setup-hooks/setup-debug-info-dirs.sh b/pkgs/build-support/setup-hooks/setup-debug-info-dirs.sh index 96bf48cf123ab..8162795fe3575 100644 --- a/pkgs/build-support/setup-hooks/setup-debug-info-dirs.sh +++ b/pkgs/build-support/setup-hooks/setup-debug-info-dirs.sh @@ -1,5 +1,5 @@ setupDebugInfoDirs () { - addToSearchPath NIX_DEBUG_INFO_DIRS $1/lib/debug + appendToSearchPath NIX_DEBUG_INFO_DIRS $1/lib/debug } addEnvHooks "$targetOffset" setupDebugInfoDirs diff --git a/pkgs/build-support/setup-hooks/win-dll-link.sh b/pkgs/build-support/setup-hooks/win-dll-link.sh index 2c63dbfb217c1..0566676753e96 100644 --- a/pkgs/build-support/setup-hooks/win-dll-link.sh +++ b/pkgs/build-support/setup-hooks/win-dll-link.sh @@ -3,8 +3,8 @@ fixupOutputHooks+=(_linkDLLs) addEnvHooks "$targetOffset" linkDLLGetFolders linkDLLGetFolders() { - addToSearchPath "LINK_DLL_FOLDERS" "$1/lib" - addToSearchPath "LINK_DLL_FOLDERS" "$1/bin" + appendToSearchPath "LINK_DLL_FOLDERS" "$1/lib" + appendToSearchPath "LINK_DLL_FOLDERS" "$1/bin" } _linkDLLs() { @@ -46,7 +46,7 @@ linkDLLsInfolder() { local DLLPATH="" local outName for outName in $(getAllOutputNames); do - addToSearchPath DLLPATH "${!outName}/bin" + appendToSearchPath DLLPATH "${!outName}/bin" done DLLPATH="$DLLPATH:$LINK_DLL_FOLDERS" diff --git a/pkgs/by-name/bu/budgie-control-center/package.nix b/pkgs/by-name/bu/budgie-control-center/package.nix index 1e97c87364d88..e4b0dccb4aff3 100644 --- a/pkgs/by-name/bu/budgie-control-center/package.nix +++ b/pkgs/by-name/bu/budgie-control-center/package.nix @@ -153,7 +153,7 @@ stdenv.mkDerivation (finalAttrs: { preConfigure = '' # For ITS rules - addToSearchPath "XDG_DATA_DIRS" "${polkit.out}/share" + appendToSearchPath "XDG_DATA_DIRS" "${polkit.out}/share" ''; postInstall = '' diff --git a/pkgs/by-name/ch/chez-racket/setup-hook.sh b/pkgs/by-name/ch/chez-racket/setup-hook.sh index 1d81489bd4e46..422840a531795 100644 --- a/pkgs/by-name/ch/chez-racket/setup-hook.sh +++ b/pkgs/by-name/ch/chez-racket/setup-hook.sh @@ -1,5 +1,5 @@ addChezLibraryPath() { - addToSearchPath CHEZSCHEMELIBDIRS "$1/lib/csv-site" + appendToSearchPath CHEZSCHEMELIBDIRS "$1/lib/csv-site" } addEnvHooks "$targetOffset" addChezLibraryPath diff --git a/pkgs/by-name/ch/chez/setup-hook.sh b/pkgs/by-name/ch/chez/setup-hook.sh index 1d81489bd4e46..422840a531795 100644 --- a/pkgs/by-name/ch/chez/setup-hook.sh +++ b/pkgs/by-name/ch/chez/setup-hook.sh @@ -1,5 +1,5 @@ addChezLibraryPath() { - addToSearchPath CHEZSCHEMELIBDIRS "$1/lib/csv-site" + appendToSearchPath CHEZSCHEMELIBDIRS "$1/lib/csv-site" } addEnvHooks "$targetOffset" addChezLibraryPath diff --git a/pkgs/by-name/cm/cmake/setup-hook.sh b/pkgs/by-name/cm/cmake/setup-hook.sh index ea2d3d2a45bba..b315bc6e7f5e4 100755 --- a/pkgs/by-name/cm/cmake/setup-hook.sh +++ b/pkgs/by-name/cm/cmake/setup-hook.sh @@ -1,7 +1,7 @@ addCMakeParams() { # NIXPKGS_CMAKE_PREFIX_PATH is like CMAKE_PREFIX_PATH except cmake # will not search it for programs - addToSearchPath NIXPKGS_CMAKE_PREFIX_PATH $1 + appendToSearchPath NIXPKGS_CMAKE_PREFIX_PATH $1 } fixCmakeFiles() { @@ -155,22 +155,22 @@ makeCmakeFindLibs() { for flag in ${NIX_CFLAGS_COMPILE-} ${NIX_LDFLAGS-}; do if test -n "$isystem_seen" && test -d "$flag"; then isystem_seen= - addToSearchPath CMAKE_INCLUDE_PATH "${flag}" + appendToSearchPath CMAKE_INCLUDE_PATH "${flag}" elif test -n "$iframework_seen" && test -d "$flag"; then iframework_seen= - addToSearchPath CMAKE_FRAMEWORK_PATH "${flag}" + appendToSearchPath CMAKE_FRAMEWORK_PATH "${flag}" else isystem_seen= iframework_seen= case $flag in -I*) - addToSearchPath CMAKE_INCLUDE_PATH "${flag:2}" + appendToSearchPath CMAKE_INCLUDE_PATH "${flag:2}" ;; -L*) - addToSearchPath CMAKE_LIBRARY_PATH "${flag:2}" + appendToSearchPath CMAKE_LIBRARY_PATH "${flag:2}" ;; -F*) - addToSearchPath CMAKE_FRAMEWORK_PATH "${flag:2}" + appendToSearchPath CMAKE_FRAMEWORK_PATH "${flag:2}" ;; -isystem) isystem_seen=1 diff --git a/pkgs/by-name/fw/fwupd/package.nix b/pkgs/by-name/fw/fwupd/package.nix index 7468ee58c7159..7d6fb6160b701 100644 --- a/pkgs/by-name/fw/fwupd/package.nix +++ b/pkgs/by-name/fw/fwupd/package.nix @@ -321,7 +321,7 @@ stdenv.mkDerivation (finalAttrs: { ]; preCheck = '' - addToSearchPath XDG_DATA_DIRS "${shared-mime-info}/share" + appendToSearchPath XDG_DATA_DIRS "${shared-mime-info}/share" echo "12345678901234567890123456789012" > machine-id export NIX_REDIRECTS=/etc/machine-id=$(realpath machine-id) \ diff --git a/pkgs/by-name/gl/glib/setup-hook.sh b/pkgs/by-name/gl/glib/setup-hook.sh index 40336f2972836..9b438de0a8477 100644 --- a/pkgs/by-name/gl/glib/setup-hook.sh +++ b/pkgs/by-name/gl/glib/setup-hook.sh @@ -2,7 +2,7 @@ make_glib_find_gsettings_schemas() { # For packages that need gschemas of other packages (e.g. empathy) for maybe_dir in "$1"/share/gsettings-schemas/*; do if [[ -d "$maybe_dir/glib-2.0/schemas" ]]; then - addToSearchPath GSETTINGS_SCHEMAS_PATH "$maybe_dir" + appendToSearchPath GSETTINGS_SCHEMAS_PATH "$maybe_dir" fi done } @@ -21,7 +21,7 @@ glibPostInstallHook() { mv "$prefix/share/glib-2.0/schemas" "${!outputLib}/share/gsettings-schemas/$name/glib-2.0/" fi - addToSearchPath GSETTINGS_SCHEMAS_PATH "${!outputLib}/share/gsettings-schemas/$name" + appendToSearchPath GSETTINGS_SCHEMAS_PATH "${!outputLib}/share/gsettings-schemas/$name" } # gappsWrapperArgsHook expects GSETTINGS_SCHEMAS_PATH variable to be set by this. diff --git a/pkgs/by-name/gn/gnome-control-center/package.nix b/pkgs/by-name/gn/gnome-control-center/package.nix index 681be6eab1353..81b53ff4f5fc7 100644 --- a/pkgs/by-name/gn/gnome-control-center/package.nix +++ b/pkgs/by-name/gn/gnome-control-center/package.nix @@ -164,7 +164,7 @@ stdenv.mkDerivation (finalAttrs: { preConfigure = '' # For ITS rules - addToSearchPath "XDG_DATA_DIRS" "${polkit.out}/share" + appendToSearchPath "XDG_DATA_DIRS" "${polkit.out}/share" ''; preCheck = '' diff --git a/pkgs/by-name/gn/gnustep-make/setup-hook.sh b/pkgs/by-name/gn/gnustep-make/setup-hook.sh index 202084cc671dc..6f038c4a070f1 100644 --- a/pkgs/by-name/gn/gnustep-make/setup-hook.sh +++ b/pkgs/by-name/gn/gnustep-make/setup-hook.sh @@ -23,9 +23,9 @@ appendToVar preInstallPhases addGnustepInstallFlags addGNUstepEnvVars() { local filename - gsAddToSearchPath() { + gsAppendToSearchPath() { if [[ -d "$2" && "${!1-}" != *"$2"* ]]; then - addToSearchPath "$1" "$2" + appendToSearchPath "$1" "$2" fi } @@ -48,17 +48,17 @@ addGNUstepEnvVars() { export NIX_GNUSTEP_MAKEFILES_ADDITIONAL - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_APPS "$1/lib/GNUstep/Applications" - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_APPS "$1/lib/GNUstep/Applications" - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_WEB_APPS "$1/lib/GNUstep/WebApplications" - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_TOOLS "$1/bin" - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS "$1/sbin" - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARY "$1/lib/GNUstep" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_APPS "$1/lib/GNUstep/Applications" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_APPS "$1/lib/GNUstep/Applications" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_WEB_APPS "$1/lib/GNUstep/WebApplications" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_TOOLS "$1/bin" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS "$1/sbin" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARY "$1/lib/GNUstep" gsAddToIncludeSearchPath NIX_GNUSTEP_SYSTEM_HEADERS "$1/include" - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARIES "$1/lib" - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_DOC "$1/share/GNUstep/Documentation" - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_DOC_MAN "$1/share/man" - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_DOC_INFO "$1/share/info" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARIES "$1/lib" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_DOC "$1/share/GNUstep/Documentation" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_DOC_MAN "$1/share/man" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_DOC_INFO "$1/share/info" } addEnvHooks "$targetOffset" addGNUstepEnvVars diff --git a/pkgs/by-name/gp/gparted/package.nix b/pkgs/by-name/gp/gparted/package.nix index 6fd2daa147b2b..549ed8e3447e6 100644 --- a/pkgs/by-name/gp/gparted/package.nix +++ b/pkgs/by-name/gp/gparted/package.nix @@ -68,7 +68,7 @@ stdenv.mkDerivation rec { preConfigure = '' # For ITS rules - addToSearchPath "XDG_DATA_DIRS" "${polkit.out}/share" + appendToSearchPath "XDG_DATA_DIRS" "${polkit.out}/share" ''; preFixup = '' diff --git a/pkgs/by-name/gr/grilo/setup-hook.sh b/pkgs/by-name/gr/grilo/setup-hook.sh index 9337c520a2075..164f62be00f30 100644 --- a/pkgs/by-name/gr/grilo/setup-hook.sh +++ b/pkgs/by-name/gr/grilo/setup-hook.sh @@ -1,6 +1,6 @@ make_grilo_find_plugins() { if [ -d "$1"/lib/grilo-0.3 ]; then - addToSearchPath GRL_PLUGIN_PATH "$1/lib/grilo-0.3" + appendToSearchPath GRL_PLUGIN_PATH "$1/lib/grilo-0.3" fi } diff --git a/pkgs/by-name/ha/hare/setup-hook.sh b/pkgs/by-name/ha/hare/setup-hook.sh index 388ed9bcf25f4..bb84bf4100b3c 100644 --- a/pkgs/by-name/ha/hare/setup-hook.sh +++ b/pkgs/by-name/ha/hare/setup-hook.sh @@ -3,14 +3,14 @@ addHarepath() { local -r thirdparty="${1-}/src/hare/third-party" if [[ -d "$thirdparty" ]]; then - addToSearchPath HAREPATH "$thirdparty" + appendToSearchPath HAREPATH "$thirdparty" fi } # Hare's stdlib should come after its third party libs, since the latter may # expand or shadow the former. readonly hareSetStdlibPhase=' -addToSearchPath HAREPATH "@hare_stdlib@" +appendToSearchPath HAREPATH "@hare_stdlib@" ' readonly hareInfoPhase=' echoCmd "HARECACHE" "$HARECACHE" diff --git a/pkgs/by-name/hi/hicolor-icon-theme/setup-hook.sh b/pkgs/by-name/hi/hicolor-icon-theme/setup-hook.sh index df7cac08b058f..40f1d93d42c52 100644 --- a/pkgs/by-name/hi/hicolor-icon-theme/setup-hook.sh +++ b/pkgs/by-name/hi/hicolor-icon-theme/setup-hook.sh @@ -5,7 +5,7 @@ hicolorIconThemeHook() { # where to find icon themes if [ -d "$1/share/icons" ]; then - addToSearchPath XDG_ICON_DIRS "$1/share" + appendToSearchPath XDG_ICON_DIRS "$1/share" fi } diff --git a/pkgs/by-name/li/librep/setup-hook.sh b/pkgs/by-name/li/librep/setup-hook.sh index 4d875b6933040..2be9c0bd45647 100644 --- a/pkgs/by-name/li/librep/setup-hook.sh +++ b/pkgs/by-name/li/librep/setup-hook.sh @@ -1,5 +1,5 @@ addRepDLLoadPath () { - addToSearchPath REP_DL_LOAD_PATH $1/lib/rep + appendToSearchPath REP_DL_LOAD_PATH $1/lib/rep } addEnvHooks "$hostOffset" addRepDLLoadPath diff --git a/pkgs/by-name/ob/obex_data_server/package.nix b/pkgs/by-name/ob/obex_data_server/package.nix index d38525342c417..5e0a20f22e7ea 100644 --- a/pkgs/by-name/ob/obex_data_server/package.nix +++ b/pkgs/by-name/ob/obex_data_server/package.nix @@ -37,7 +37,7 @@ stdenv.mkDerivation rec { patches = [ ./obex-data-server-0.4.6-build-fixes-1.patch ]; preConfigure = '' - addToSearchPath PKG_CONFIG_PATH ${openobex}/lib64/pkgconfig + appendToSearchPath PKG_CONFIG_PATH ${openobex}/lib64/pkgconfig export PKG_CONFIG_PATH="${dbus.dev}/lib/pkgconfig:$PKG_CONFIG_PATH" ''; diff --git a/pkgs/by-name/pa/patchPpdFilesHook/patch-ppd-hook.sh b/pkgs/by-name/pa/patchPpdFilesHook/patch-ppd-hook.sh index 8227146364157..d83bd83f2abea 100644 --- a/pkgs/by-name/pa/patchPpdFilesHook/patch-ppd-hook.sh +++ b/pkgs/by-name/pa/patchPpdFilesHook/patch-ppd-hook.sh @@ -71,15 +71,15 @@ patchPpdFileCommands () { # * `/lib/cups/filter' before `/bin` # * add HOST_PATH at end, so we don't miss anything for path in $(getAllOutputNames); do - addToSearchPath cupspath "${!path}/lib/cups/filter" - addToSearchPath cupspath "${!path}/bin" + appendToSearchPath cupspath "${!path}/lib/cups/filter" + appendToSearchPath cupspath "${!path}/bin" done for path in ${pkgsHostTarget+"${pkgsHostTarget[@]}"}; do - addToSearchPath cupspath "$path/lib/cups/filter" - addToSearchPath cupspath "$path/bin" + appendToSearchPath cupspath "$path/lib/cups/filter" + appendToSearchPath cupspath "$path/bin" done while read -r -d : path; do - addToSearchPath cupspath "$path" + appendToSearchPath cupspath "$path" done <<< "${HOST_PATH:+"${HOST_PATH}:"}" # create list of compressed ppd files diff --git a/pkgs/by-name/ro/root/setup-hook.sh b/pkgs/by-name/ro/root/setup-hook.sh index e8af80d602b00..253119b60b5f0 100644 --- a/pkgs/by-name/ro/root/setup-hook.sh +++ b/pkgs/by-name/ro/root/setup-hook.sh @@ -5,7 +5,7 @@ thisroot () { postHooks+=(thisroot) addRootIncludePath() { - addToSearchPath ROOT_INCLUDE_PATH $1/include + appendToSearchPath ROOT_INCLUDE_PATH $1/include } addEnvHooks "$targetOffset" addRootIncludePath diff --git a/pkgs/by-name/ro/root5/setup-hook.sh b/pkgs/by-name/ro/root5/setup-hook.sh index 7affd21012eb6..4e53bc1d325cf 100644 --- a/pkgs/by-name/ro/root5/setup-hook.sh +++ b/pkgs/by-name/ro/root5/setup-hook.sh @@ -13,7 +13,7 @@ thisroot () { postHooks+=(thisroot) addRootIncludePath() { - addToSearchPath ROOT_INCLUDE_PATH $1/include + appendToSearchPath ROOT_INCLUDE_PATH $1/include } addEnvHooks "$targetOffset" addRootIncludePath diff --git a/pkgs/by-name/se/seahorse/package.nix b/pkgs/by-name/se/seahorse/package.nix index 1abdef69c7345..6f14c4fd6ea5f 100644 --- a/pkgs/by-name/se/seahorse/package.nix +++ b/pkgs/by-name/se/seahorse/package.nix @@ -87,7 +87,7 @@ stdenv.mkDerivation rec { # Add “org.gnome.crypto.pgp” GSettings schema to path # to make it available for “gpgme-backend” test. # It is used by Seahorse’s internal “common” library. - addToSearchPath XDG_DATA_DIRS "${glib.getSchemaDataDirPath gcr}" + appendToSearchPath XDG_DATA_DIRS "${glib.getSchemaDataDirPath gcr}" # The same test also requires home directory so that it can store settings. export HOME=$TMPDIR ''; diff --git a/pkgs/by-name/vk/vkdevicechooser/package.nix b/pkgs/by-name/vk/vkdevicechooser/package.nix index 2af58ec884240..f534789cbcb36 100644 --- a/pkgs/by-name/vk/vkdevicechooser/package.nix +++ b/pkgs/by-name/vk/vkdevicechooser/package.nix @@ -34,7 +34,7 @@ stdenv.mkDerivation rec { # Help vulkan-loader find the layer setupHook = writeText "setup-hook" '' - addToSearchPath XDG_DATA_DIRS @out@/share + appendToSearchPath XDG_DATA_DIRS @out@/share ''; # Include absolute paths to layer libraries in their associated diff --git a/pkgs/by-name/vu/vulkan-extension-layer/package.nix b/pkgs/by-name/vu/vulkan-extension-layer/package.nix index 2a65766295dd2..794c0de6fbfe5 100644 --- a/pkgs/by-name/vu/vulkan-extension-layer/package.nix +++ b/pkgs/by-name/vu/vulkan-extension-layer/package.nix @@ -42,7 +42,7 @@ stdenv.mkDerivation rec { # Help vulkan-loader find the validation layers setupHook = writeText "setup-hook" '' - addToSearchPath XDG_DATA_DIRS @out@/share + appendToSearchPath XDG_DATA_DIRS @out@/share ''; # Tests are not for gpu-less and headless environments diff --git a/pkgs/by-name/wr/wrapGNUstepAppsHook/wrapGNUstepAppsHook.sh b/pkgs/by-name/wr/wrapGNUstepAppsHook/wrapGNUstepAppsHook.sh index 8218ff1e7746c..db7e3a13cdb2b 100644 --- a/pkgs/by-name/wr/wrapGNUstepAppsHook/wrapGNUstepAppsHook.sh +++ b/pkgs/by-name/wr/wrapGNUstepAppsHook/wrapGNUstepAppsHook.sh @@ -32,9 +32,9 @@ if [[ -z "${__nix_wrapGNUstepAppsHook-}" ]]; then echo "writing GNUstep config file" - gsAddToSearchPath() { + gsAppendToSearchPath() { if [[ -d "$2" && "${!1-}" != *"$2"* ]]; then - addToSearchPath "$1" "$2" + appendToSearchPath "$1" "$2" fi } @@ -50,17 +50,17 @@ if [[ -z "${__nix_wrapGNUstepAppsHook-}" ]]; then fi } - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_APPS "$out/lib/GNUstep/Applications" - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_APPS "$out/lib/GNUstep/Applications" - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_WEB_APPS "$out/lib/GNUstep/WebApplications" - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_TOOLS "$out/bin" - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS "$out/sbin" - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARY "$out/lib/GNUstep" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_APPS "$out/lib/GNUstep/Applications" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_APPS "$out/lib/GNUstep/Applications" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_WEB_APPS "$out/lib/GNUstep/WebApplications" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_TOOLS "$out/bin" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS "$out/sbin" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARY "$out/lib/GNUstep" gsAddToIncludeSearchPath NIX_GNUSTEP_SYSTEM_HEADERS "$out/include" - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARIES "$out/lib" - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_DOC "$out/share/GNUstep/Documentation" - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_DOC_MAN "$out/share/man" - gsAddToSearchPath NIX_GNUSTEP_SYSTEM_DOC_INFO "$out/share/info" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARIES "$out/lib" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_DOC "$out/share/GNUstep/Documentation" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_DOC_MAN "$out/share/man" + gsAppendToSearchPath NIX_GNUSTEP_SYSTEM_DOC_INFO "$out/share/info" for var in "${gnustepConfigVars[@]}"; do if [[ -n "${!var-}" ]]; then diff --git a/pkgs/development/ada-modules/gprbuild/gpr-project-path-hook.sh b/pkgs/development/ada-modules/gprbuild/gpr-project-path-hook.sh index f98b2ab9e58d3..d21ef3c01ab1f 100644 --- a/pkgs/development/ada-modules/gprbuild/gpr-project-path-hook.sh +++ b/pkgs/development/ada-modules/gprbuild/gpr-project-path-hook.sh @@ -2,7 +2,7 @@ addAdaObjectsPath() { local role_post getHostRoleEnvHook - addToSearchPath "GPR_PROJECT_PATH${role_post}" "$1/share/gpr" + appendToSearchPath "GPR_PROJECT_PATH${role_post}" "$1/share/gpr" } addEnvHooks "$targetOffset" addAdaObjectsPath diff --git a/pkgs/development/beam-modules/build-erlang-mk.nix b/pkgs/development/beam-modules/build-erlang-mk.nix index c5e8e6b5ad185..050228e7cd20a 100644 --- a/pkgs/development/beam-modules/build-erlang-mk.nix +++ b/pkgs/development/beam-modules/build-erlang-mk.nix @@ -53,7 +53,7 @@ let setupHook = if setupHook == null then writeText "setupHook.sh" '' - addToSearchPath ERL_LIBS "$1/lib/erlang/lib" + appendToSearchPath ERL_LIBS "$1/lib/erlang/lib" '' else setupHook; diff --git a/pkgs/development/beam-modules/build-mix.nix b/pkgs/development/beam-modules/build-mix.nix index dd2d3f7dea970..8bc47e4a0ef68 100644 --- a/pkgs/development/beam-modules/build-mix.nix +++ b/pkgs/development/beam-modules/build-mix.nix @@ -64,7 +64,7 @@ let # http://erlang.org/doc/man/code.html#code-path # Mix also searches the code path when compiling with the --no-deps-check flag setupHook = attrs.setupHook or writeText "setupHook.sh" '' - addToSearchPath ERL_LIBS "$1/lib/erlang/lib" + appendToSearchPath ERL_LIBS "$1/lib/erlang/lib" ''; buildInputs = buildInputs ++ [ ]; diff --git a/pkgs/development/beam-modules/build-rebar3.nix b/pkgs/development/beam-modules/build-rebar3.nix index 781b6a7a78fe0..a6e062b8d07ff 100644 --- a/pkgs/development/beam-modules/build-rebar3.nix +++ b/pkgs/development/beam-modules/build-rebar3.nix @@ -73,7 +73,7 @@ let dontStrip = false; setupHook = writeText "setupHook.sh" '' - addToSearchPath ERL_LIBS "$1/lib/erlang/lib/" + appendToSearchPath ERL_LIBS "$1/lib/erlang/lib/" ''; postPatch = diff --git a/pkgs/development/beam-modules/hex/default.nix b/pkgs/development/beam-modules/hex/default.nix index 74de36b9269eb..9edadb0c3fe0a 100644 --- a/pkgs/development/beam-modules/hex/default.nix +++ b/pkgs/development/beam-modules/hex/default.nix @@ -28,7 +28,7 @@ let }; setupHook = writeText "setupHook.sh" '' - addToSearchPath ERL_LIBS "$1/lib/erlang/lib/" + appendToSearchPath ERL_LIBS "$1/lib/erlang/lib/" ''; dontStrip = true; diff --git a/pkgs/development/beam-modules/webdriver/default.nix b/pkgs/development/beam-modules/webdriver/default.nix index f8abc24c14edd..15be530916d81 100644 --- a/pkgs/development/beam-modules/webdriver/default.nix +++ b/pkgs/development/beam-modules/webdriver/default.nix @@ -28,7 +28,7 @@ let }; setupHook = writeText "setupHook.sh" '' - addToSearchPath ERL_LIBS "$1/lib/erlang/lib/" + appendToSearchPath ERL_LIBS "$1/lib/erlang/lib/" ''; buildInputs = [ erlang ]; diff --git a/pkgs/development/compilers/chicken/4/setup-hook.sh b/pkgs/development/compilers/chicken/4/setup-hook.sh index 661dc08c090c4..3807c2bcd5863 100644 --- a/pkgs/development/compilers/chicken/4/setup-hook.sh +++ b/pkgs/development/compilers/chicken/4/setup-hook.sh @@ -1,5 +1,5 @@ addChickenRepositoryPath() { - addToSearchPathWithCustomDelimiter : CHICKEN_REPOSITORY_EXTRA "$1/lib/chicken/8/" + appendToSearchPathWithCustomDelimiter : CHICKEN_REPOSITORY_EXTRA "$1/lib/chicken/8/" export CHICKEN_INCLUDE_PATH="$1/share${CHICKEN_INCLUDE_PATH:+;$CHICKEN_INCLUDE_PATH}" } diff --git a/pkgs/development/compilers/chicken/5/setup-hook.sh b/pkgs/development/compilers/chicken/5/setup-hook.sh index 55324c05508eb..47c4fb6d7be30 100644 --- a/pkgs/development/compilers/chicken/5/setup-hook.sh +++ b/pkgs/development/compilers/chicken/5/setup-hook.sh @@ -1,6 +1,6 @@ addChickenRepositoryPath() { - addToSearchPathWithCustomDelimiter : CHICKEN_REPOSITORY_PATH "$1/lib/chicken/11" - addToSearchPathWithCustomDelimiter : CHICKEN_INCLUDE_PATH "$1/share" + appendToSearchPathWithCustomDelimiter : CHICKEN_REPOSITORY_PATH "$1/lib/chicken/11" + appendToSearchPathWithCustomDelimiter : CHICKEN_INCLUDE_PATH "$1/share" } addEnvHooks "$targetOffset" addChickenRepositoryPath diff --git a/pkgs/development/compilers/dotnet/vmr.nix b/pkgs/development/compilers/dotnet/vmr.nix index 30923aa65d34e..67888d1df87ee 100644 --- a/pkgs/development/compilers/dotnet/vmr.nix +++ b/pkgs/development/compilers/dotnet/vmr.nix @@ -65,7 +65,7 @@ stdenv.mkDerivation rec { # TODO: fix this in the binary sdk packages preHook = lib.optionalString stdenv.hostPlatform.isDarwin '' - addToSearchPath DYLD_LIBRARY_PATH "${_icu}/lib" + appendToSearchPath DYLD_LIBRARY_PATH "${_icu}/lib" export DYLD_LIBRARY_PATH ''; diff --git a/pkgs/development/compilers/flutter/wrapper.nix b/pkgs/development/compilers/flutter/wrapper.nix index 57f945477f41a..b360c6ff16c24 100644 --- a/pkgs/development/compilers/flutter/wrapper.nix +++ b/pkgs/development/compilers/flutter/wrapper.nix @@ -174,7 +174,7 @@ in ) [ ] pkgConfigPackages ) }; do - addToSearchPath FLUTTER_PKG_CONFIG_PATH "$path" + appendToSearchPath FLUTTER_PKG_CONFIG_PATH "$path" done mkdir -p $out/bin diff --git a/pkgs/development/compilers/haxe/setup-hook.sh b/pkgs/development/compilers/haxe/setup-hook.sh index e6496107a5ee1..79f401cac75d4 100644 --- a/pkgs/development/compilers/haxe/setup-hook.sh +++ b/pkgs/development/compilers/haxe/setup-hook.sh @@ -1,6 +1,6 @@ addHaxeLibPath() { if [ ! -d "$1/lib/haxe/std" ]; then - addToSearchPath HAXELIB_PATH "$1/lib/haxe" + appendToSearchPath HAXELIB_PATH "$1/lib/haxe" fi } diff --git a/pkgs/development/compilers/vala/setup-hook.sh b/pkgs/development/compilers/vala/setup-hook.sh index 5e7bc352718fd..e9dd2fbf58c7a 100644 --- a/pkgs/development/compilers/vala/setup-hook.sh +++ b/pkgs/development/compilers/vala/setup-hook.sh @@ -1,7 +1,7 @@ make_vala_find_vapi_files() { # XDG_DATA_DIRS: required for finding .vapi files if [ -d "$1/share/vala/vapi" -o -d "$1/share/vala-@apiVersion@/vapi" ]; then - addToSearchPath XDG_DATA_DIRS $1/share + appendToSearchPath XDG_DATA_DIRS $1/share fi } diff --git a/pkgs/development/compilers/yosys/setup-hook.sh b/pkgs/development/compilers/yosys/setup-hook.sh index d01bbdd1a8c12..68c8f4106c1e4 100644 --- a/pkgs/development/compilers/yosys/setup-hook.sh +++ b/pkgs/development/compilers/yosys/setup-hook.sh @@ -1,5 +1,5 @@ addYosysPluginPath() { - addToSearchPath NIX_YOSYS_PLUGIN_DIRS "$1/share/yosys/plugins" + appendToSearchPath NIX_YOSYS_PLUGIN_DIRS "$1/share/yosys/plugins" } addEnvHooks "$targetOffset" addYosysPluginPath diff --git a/pkgs/development/cuda-modules/setup-hooks/setup-cuda-hook.sh b/pkgs/development/cuda-modules/setup-hooks/setup-cuda-hook.sh index 7586f9f4b4141..120b5fab7e146 100644 --- a/pkgs/development/cuda-modules/setup-hooks/setup-cuda-hook.sh +++ b/pkgs/development/cuda-modules/setup-hooks/setup-cuda-hook.sh @@ -48,9 +48,9 @@ setupCUDAToolkit_ROOT() { (( "${NIX_DEBUG:-0}" >= 1 )) && echo "setupCUDAToolkit_ROOT: cudaHostPathsSeen=${!cudaHostPathsSeen[*]}" >&2 for path in "${!cudaHostPathsSeen[@]}" ; do - addToSearchPathWithCustomDelimiter ";" CUDAToolkit_ROOT "$path" + appendToSearchPathWithCustomDelimiter ";" CUDAToolkit_ROOT "$path" if [[ -d "$path/include" ]] ; then - addToSearchPathWithCustomDelimiter ";" CUDAToolkit_INCLUDE_DIR "$path/include" + appendToSearchPathWithCustomDelimiter ";" CUDAToolkit_INCLUDE_DIR "$path/include" fi done diff --git a/pkgs/development/interpreters/emilua/setup-hook.sh b/pkgs/development/interpreters/emilua/setup-hook.sh index 034b52796468e..c8fbea80e6776 100644 --- a/pkgs/development/interpreters/emilua/setup-hook.sh +++ b/pkgs/development/interpreters/emilua/setup-hook.sh @@ -1,5 +1,5 @@ addEmiluaPath() { - addToSearchPathWithCustomDelimiter : EMILUA_PATH $1/@sitePackages@ + appendToSearchPathWithCustomDelimiter : EMILUA_PATH $1/@sitePackages@ } toEmiluaPath() { diff --git a/pkgs/development/interpreters/guile/setup-hook-1.8.sh b/pkgs/development/interpreters/guile/setup-hook-1.8.sh index 9a6ffb793a78b..945b66cbeb9bb 100644 --- a/pkgs/development/interpreters/guile/setup-hook-1.8.sh +++ b/pkgs/development/interpreters/guile/setup-hook-1.8.sh @@ -1,6 +1,6 @@ addGuileLibPath () { if test -d "$1/share/guile/site"; then - addToSearchPath GUILE_LOAD_PATH "$1/share/guile/site" + appendToSearchPath GUILE_LOAD_PATH "$1/share/guile/site" fi } diff --git a/pkgs/development/interpreters/guile/setup-hook-2.0.sh b/pkgs/development/interpreters/guile/setup-hook-2.0.sh index 9ef0fae011b58..ccdf07ac5cf74 100644 --- a/pkgs/development/interpreters/guile/setup-hook-2.0.sh +++ b/pkgs/development/interpreters/guile/setup-hook-2.0.sh @@ -1,18 +1,18 @@ addGuileLibPath () { if test -d "$1/share/guile/site/2.0"; then - addToSearchPath GUILE_LOAD_PATH "$1/share/guile/site/2.0" - addToSearchPath GUILE_LOAD_COMPILED_PATH "$1/share/guile/site/2.0" + appendToSearchPath GUILE_LOAD_PATH "$1/share/guile/site/2.0" + appendToSearchPath GUILE_LOAD_COMPILED_PATH "$1/share/guile/site/2.0" elif test -d "$1/share/guile/site"; then - addToSearchPath GUILE_LOAD_PATH "$1/share/guile/site" - addToSearchPath GUILE_LOAD_COMPILED_PATH "$1/share/guile/site" + appendToSearchPath GUILE_LOAD_PATH "$1/share/guile/site" + appendToSearchPath GUILE_LOAD_COMPILED_PATH "$1/share/guile/site" fi if test -d "$1/lib/guile/2.0/ccache"; then - addToSearchPath GUILE_LOAD_COMPILED_PATH "$1/lib/guile/2.0/ccache" + appendToSearchPath GUILE_LOAD_COMPILED_PATH "$1/lib/guile/2.0/ccache" fi if test -d "$1/lib/guile/2.0/site-ccache"; then - addToSearchPath GUILE_LOAD_COMPILED_PATH "$1/lib/guile/2.0/site-ccache" + appendToSearchPath GUILE_LOAD_COMPILED_PATH "$1/lib/guile/2.0/site-ccache" fi } diff --git a/pkgs/development/interpreters/guile/setup-hook-2.2.sh b/pkgs/development/interpreters/guile/setup-hook-2.2.sh index 932a5b6c41e64..f7b39e70ce06a 100644 --- a/pkgs/development/interpreters/guile/setup-hook-2.2.sh +++ b/pkgs/development/interpreters/guile/setup-hook-2.2.sh @@ -1,18 +1,18 @@ addGuileLibPath () { if test -d "$1/share/guile/site/2.2"; then - addToSearchPath GUILE_LOAD_PATH "$1/share/guile/site/2.2" - addToSearchPath GUILE_LOAD_COMPILED_PATH "$1/share/guile/site/2.2" + appendToSearchPath GUILE_LOAD_PATH "$1/share/guile/site/2.2" + appendToSearchPath GUILE_LOAD_COMPILED_PATH "$1/share/guile/site/2.2" elif test -d "$1/share/guile/site"; then - addToSearchPath GUILE_LOAD_PATH "$1/share/guile/site" - addToSearchPath GUILE_LOAD_COMPILED_PATH "$1/share/guile/site" + appendToSearchPath GUILE_LOAD_PATH "$1/share/guile/site" + appendToSearchPath GUILE_LOAD_COMPILED_PATH "$1/share/guile/site" fi if test -d "$1/lib/guile/2.2/ccache"; then - addToSearchPath GUILE_LOAD_COMPILED_PATH "$1/lib/guile/2.2/ccache" + appendToSearchPath GUILE_LOAD_COMPILED_PATH "$1/lib/guile/2.2/ccache" fi if test -d "$1/lib/guile/2.2/site-ccache"; then - addToSearchPath GUILE_LOAD_COMPILED_PATH "$1/lib/guile/2.2/site-ccache" + appendToSearchPath GUILE_LOAD_COMPILED_PATH "$1/lib/guile/2.2/site-ccache" fi } diff --git a/pkgs/development/interpreters/guile/setup-hook-3.0.sh b/pkgs/development/interpreters/guile/setup-hook-3.0.sh index 1a71e82d13a22..7646a7f7bafdf 100644 --- a/pkgs/development/interpreters/guile/setup-hook-3.0.sh +++ b/pkgs/development/interpreters/guile/setup-hook-3.0.sh @@ -1,24 +1,24 @@ addGuileLibPath () { if test -d "$1/share/guile/site/3.0"; then - addToSearchPath GUILE_LOAD_PATH "$1/share/guile/site/3.0" - addToSearchPath GUILE_LOAD_COMPILED_PATH "$1/share/guile/site/3.0" - addToSearchPath GUILE_EXTENSIONS_PATH "$1/share/guile/site/3.0" + appendToSearchPath GUILE_LOAD_PATH "$1/share/guile/site/3.0" + appendToSearchPath GUILE_LOAD_COMPILED_PATH "$1/share/guile/site/3.0" + appendToSearchPath GUILE_EXTENSIONS_PATH "$1/share/guile/site/3.0" elif test -d "$1/share/guile/site"; then - addToSearchPath GUILE_LOAD_PATH "$1/share/guile/site" - addToSearchPath GUILE_LOAD_COMPILED_PATH "$1/share/guile/site" - addToSearchPath GUILE_EXTENSIONS_PATH "$1/share/guile/site" + appendToSearchPath GUILE_LOAD_PATH "$1/share/guile/site" + appendToSearchPath GUILE_LOAD_COMPILED_PATH "$1/share/guile/site" + appendToSearchPath GUILE_EXTENSIONS_PATH "$1/share/guile/site" fi if test -d "$1/lib/guile/3.0/ccache"; then - addToSearchPath GUILE_LOAD_COMPILED_PATH "$1/lib/guile/3.0/ccache" + appendToSearchPath GUILE_LOAD_COMPILED_PATH "$1/lib/guile/3.0/ccache" fi if test -d "$1/lib/guile/3.0/site-ccache"; then - addToSearchPath GUILE_LOAD_COMPILED_PATH "$1/lib/guile/3.0/site-ccache" + appendToSearchPath GUILE_LOAD_COMPILED_PATH "$1/lib/guile/3.0/site-ccache" fi if test -d "$1/lib/guile/3.0/extensions"; then - addToSearchPath GUILE_EXTENSIONS_PATH "$1/lib/guile/3.0/extensions" + appendToSearchPath GUILE_EXTENSIONS_PATH "$1/lib/guile/3.0/extensions" fi } diff --git a/pkgs/development/interpreters/jruby/default.nix b/pkgs/development/interpreters/jruby/default.nix index c35331aba57bd..6ae02d1ed3d9c 100644 --- a/pkgs/development/interpreters/jruby/default.nix +++ b/pkgs/development/interpreters/jruby/default.nix @@ -43,7 +43,7 @@ stdenv.mkDerivation (finalAttrs: { mkdir -p $out/nix-support cat > $out/nix-support/setup-hook </dev/null - addToSearchPath program_PATH "$dir"/bin + appendToSearchPath program_PATH "$dir"/bin # Inspect the propagated inputs (if they exist) and recur on them. local prop="$dir/nix-support/propagated-build-inputs" diff --git a/pkgs/development/interpreters/octave/wrap.sh b/pkgs/development/interpreters/octave/wrap.sh index a5969fca2a96e..28a09b896260f 100644 --- a/pkgs/development/interpreters/octave/wrap.sh +++ b/pkgs/development/interpreters/octave/wrap.sh @@ -101,8 +101,8 @@ buildOctavePath() { program_PATH= octavePathsSeen["$out"]=1 octavePathsSeen["@octave@"]=1 - addToSearchPath program_PATH "$out/bin" - addToSearchPath program_PATH "@octave@/bin" + appendToSearchPath program_PATH "$out/bin" + appendToSearchPath program_PATH "@octave@/bin" echo "program_PATH to change to is: $program_PATH" for path in $pathsToSearch; do echo "Recurse to propagated-build-input: $path" @@ -118,9 +118,9 @@ _addToOctavePath() { # Stop if we've already visited this path. if [ -n "${octavePathsSeen[$dir]}" ]; then return; fi octavePathsSeen[$dir]=1 - # addToSearchPath is defined in stdenv/generic/setup.sh. It has the effect + # appendToSearchPath is defined in stdenv/generic/setup.sh. It has the effect # of calling `export X=$dir/...:$X`. - addToSearchPath program_PATH $dir/bin + appendToSearchPath program_PATH $dir/bin # Inspect the propagated inputs (if they exist) and recur on them. local prop="$dir/nix-support/propagated-build-inputs" diff --git a/pkgs/development/interpreters/perl/setup-hook-cross.sh b/pkgs/development/interpreters/perl/setup-hook-cross.sh index a7aad6f2453ea..ce31aa2a2b98a 100644 --- a/pkgs/development/interpreters/perl/setup-hook-cross.sh +++ b/pkgs/development/interpreters/perl/setup-hook-cross.sh @@ -1,12 +1,12 @@ addPerlLibPath () { - addToSearchPath PERL5LIB $1/lib/perl5/site_perl/@version@ - addToSearchPath PERL5LIB $1/lib/perl5/site_perl/cross_perl/@version@ + appendToSearchPath PERL5LIB $1/lib/perl5/site_perl/@version@ + appendToSearchPath PERL5LIB $1/lib/perl5/site_perl/cross_perl/@version@ # Adding the arch-specific directory is morally incorrect, as # miniperl can't load the native modules there. However, it can # (and sometimes needs to) load and run some of the pure perl # code there, so we add it anyway. When needed, stubs can be put # into $1/lib/perl5/site_perl/cross_perl/@version@ - addToSearchPath PERL5LIB $1/lib/perl5/site_perl/@version@/@runtimeArch@ + appendToSearchPath PERL5LIB $1/lib/perl5/site_perl/@version@/@runtimeArch@ } addEnvHooks "$hostOffset" addPerlLibPath diff --git a/pkgs/development/interpreters/perl/setup-hook.sh b/pkgs/development/interpreters/perl/setup-hook.sh index 7909412806c82..b9afb257e53a5 100644 --- a/pkgs/development/interpreters/perl/setup-hook.sh +++ b/pkgs/development/interpreters/perl/setup-hook.sh @@ -1,5 +1,5 @@ addPerlLibPath () { - addToSearchPath PERL5LIB $1/lib/perl5/site_perl + appendToSearchPath PERL5LIB $1/lib/perl5/site_perl } addEnvHooks "$hostOffset" addPerlLibPath diff --git a/pkgs/development/interpreters/python/setup-hook.sh b/pkgs/development/interpreters/python/setup-hook.sh index 523df5762fadb..8eb734fe99737 100644 --- a/pkgs/development/interpreters/python/setup-hook.sh +++ b/pkgs/development/interpreters/python/setup-hook.sh @@ -1,5 +1,5 @@ addPythonPath() { - addToSearchPathWithCustomDelimiter : PYTHONPATH $1/@sitePackages@ + appendToSearchPathWithCustomDelimiter : PYTHONPATH $1/@sitePackages@ } toPythonPath() { diff --git a/pkgs/development/interpreters/python/wrap.sh b/pkgs/development/interpreters/python/wrap.sh index f10ba003432be..8b47f08f645c4 100644 --- a/pkgs/development/interpreters/python/wrap.sh +++ b/pkgs/development/interpreters/python/wrap.sh @@ -17,7 +17,7 @@ buildPythonPath() { program_PYTHONPATH= program_PATH= pythonPathsSeen["@pythonHost@"]=1 - addToSearchPath program_PATH @pythonHost@/bin + appendToSearchPath program_PATH @pythonHost@/bin for path in $pythonPath; do _addToPythonPath $path done @@ -107,10 +107,10 @@ _addToPythonPath() { # Stop if we've already visited here. if [ -n "${pythonPathsSeen[$dir]}" ]; then return; fi pythonPathsSeen[$dir]=1 - # addToSearchPath is defined in stdenv/generic/setup.sh. It will have + # appendToSearchPath is defined in stdenv/generic/setup.sh. It will have # the effect of calling `export program_X=$dir/...:$program_X`. - addToSearchPath program_PYTHONPATH $dir/@sitePackages@ - addToSearchPath program_PATH $dir/bin + appendToSearchPath program_PYTHONPATH $dir/@sitePackages@ + appendToSearchPath program_PATH $dir/bin # Inspect the propagated inputs (if they exist) and recur on them. local prop="$dir/nix-support/propagated-build-inputs" diff --git a/pkgs/development/interpreters/racket/default.nix b/pkgs/development/interpreters/racket/default.nix index 45ee63f0ec7e9..92fe5b45fa8c2 100644 --- a/pkgs/development/interpreters/racket/default.nix +++ b/pkgs/development/interpreters/racket/default.nix @@ -80,7 +80,7 @@ minimal.overrideAttrs ( */ '' for lib_path in ${libPaths}; do - addToSearchPath ${libPathsVar} $lib_path + appendToSearchPath ${libPathsVar} $lib_path done '' # Fixes Fontconfig errors diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix index 78665913fdd70..01d42c6ad8975 100644 --- a/pkgs/development/interpreters/ruby/default.nix +++ b/pkgs/development/interpreters/ruby/default.nix @@ -327,12 +327,12 @@ let mkdir -p $out/nix-support cat > $out/nix-support/setup-hook <&2 exit 1 @@ -796,6 +816,8 @@ findInputs() { done done done + + eval "$var"'+=("$pkg")' } # The way we handle deps* and *Inputs works with structured attrs @@ -804,16 +826,19 @@ findInputs() { # Make sure all are at least defined as empty : "${depsBuildBuild=}" "${depsBuildBuildPropagated=}" -: "${nativeBuildInputs=}" "${propagatedNativeBuildInputs=}" "${defaultNativeBuildInputs=}" +: "${defaultNativeBuildInputs=}" "${nativeBuildInputs=}" "${propagatedNativeBuildInputs=}" : "${depsBuildTarget=}" "${depsBuildTargetPropagated=}" : "${depsHostHost=}" "${depsHostHostPropagated=}" -: "${buildInputs=}" "${propagatedBuildInputs=}" "${defaultBuildInputs=}" +: "${defaultBuildInputs=}" "${buildInputs=}" "${propagatedBuildInputs=}" : "${depsTargetTarget=}" "${depsTargetTargetPropagated=}" +# N.B. In both cases, default dependencies must be processed first, so +# they are overriden by explicit ones. + for pkg in ${depsBuildBuild[@]} ${depsBuildBuildPropagated[@]}; do findInputs "$pkg" -1 -1 done -for pkg in ${nativeBuildInputs[@]} ${propagatedNativeBuildInputs[@]}; do +for pkg in ${defaultNativeBuildInputs[@]} ${nativeBuildInputs[@]} ${propagatedNativeBuildInputs[@]}; do findInputs "$pkg" -1 0 done for pkg in ${depsBuildTarget[@]} ${depsBuildTargetPropagated[@]}; do @@ -822,19 +847,12 @@ done for pkg in ${depsHostHost[@]} ${depsHostHostPropagated[@]}; do findInputs "$pkg" 0 0 done -for pkg in ${buildInputs[@]} ${propagatedBuildInputs[@]} ; do +for pkg in ${defaultBuildInputs[@]} ${buildInputs[@]} ${propagatedBuildInputs[@]} ; do findInputs "$pkg" 0 1 done for pkg in ${depsTargetTarget[@]} ${depsTargetTargetPropagated[@]}; do findInputs "$pkg" 1 1 done -# Default inputs must be processed last -for pkg in ${defaultNativeBuildInputs[@]}; do - findInputs "$pkg" -1 0 -done -for pkg in ${defaultBuildInputs[@]}; do - findInputs "$pkg" 0 1 -done # Add package to the future PATH and run setup hooks activatePackage() { @@ -858,15 +876,15 @@ activatePackage() { # # TODO(@Ericson2314): Don't special-case native compilation if [[ -z "${strictDeps-}" || "$hostOffset" -le -1 ]]; then - addToSearchPath _PATH "$pkg/bin" + prependToSearchPath _PATH "$pkg/bin" fi if (( hostOffset <= -1 )); then - addToSearchPath _XDG_DATA_DIRS "$pkg/share" + prependToSearchPath _XDG_DATA_DIRS "$pkg/share" fi if [[ "$hostOffset" -eq 0 && -d "$pkg/bin" ]]; then - addToSearchPath _HOST_PATH "$pkg/bin" + prependToSearchPath _HOST_PATH "$pkg/bin" fi if [[ -f "$pkg/nix-support/setup-hook" ]]; then diff --git a/pkgs/tools/package-management/akku/setup-hook.sh b/pkgs/tools/package-management/akku/setup-hook.sh index 0309475bb8ce7..72cbe5aac1065 100755 --- a/pkgs/tools/package-management/akku/setup-hook.sh +++ b/pkgs/tools/package-management/akku/setup-hook.sh @@ -19,7 +19,7 @@ GAUCHE_LOAD_PATH ' addToAkkuEnv () { - adder="addToSearchPath" + adder="appendToSearchPath" for env_var in $scheme_vars; do $adder $env_var "$1/lib/scheme-libs" done