treewide: Don't use envHook anymore

This commits needs a MAJOR audit as I oftentimes just guessed which of
`$hostOffset`, `$targetOffset`, or a fixed offset should be used.
This commit is contained in:
John Ericson 2017-08-10 18:22:07 -04:00
parent a1cdc2011e
commit 046f091e0d
54 changed files with 64 additions and 80 deletions

View file

@ -60,7 +60,7 @@ stdenv.mkDerivation {
fi fi
} }
envHooks=(''${envHooks[@]} addCoqPath) addEnvHooks "$targetOffset" addCoqPath
''; '';
passthru = { passthru = {

View file

@ -109,7 +109,7 @@ self = stdenv.mkDerivation {
fi fi
} }
envHooks=(''${envHooks[@]} addCoqPath) addEnvHooks "$targetOffset" addCoqPath
''; '';
preConfigure = '' preConfigure = ''

View file

@ -1,5 +1,7 @@
addRLibPath () { addRLibPath () {
addToSearchPath R_LIBS_SITE $1/library if [[ -d "$1/library" ]]; then
addToSearchPath R_LIBS_SITE "$1/library"
fi
} }
envHooks+=(addRLibPath) addEnvHooks "$targetOffset" addRLibPath

View file

@ -4,4 +4,8 @@ addEmacsVars () {
fi fi
} }
envHooks+=(addEmacsVars) # If this is for a wrapper derivation, emacs and the dependencies are all
# run-time dependencies. If this is for precompiling packages into bytecode,
# emacs is a compile-time dependency of the package.
addEnvHooks "$targetOffset" addEmacsVars
addEnvHooks "$targetOffset" addEmacsVars

View file

@ -1,4 +1,4 @@
addCVars () { gccWrapperOld_addCVars () {
if test -d $1/include; then if test -d $1/include; then
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem $1/include" export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem $1/include"
fi fi
@ -12,7 +12,7 @@ addCVars () {
fi fi
} }
envHooks=(${envHooks[@]} addCVars) envBuildBuildHooks+=(gccWrapperOld_addCVars)
# Note: these come *after* $out in the PATH (see setup.sh). # Note: these come *after* $out in the PATH (see setup.sh).

View file

@ -18,5 +18,5 @@ if [ -z "$libxmlHookDone" ]; then
# xmllint and xsltproc from looking in /etc/xml/catalog. # xmllint and xsltproc from looking in /etc/xml/catalog.
export XML_CATALOG_FILES export XML_CATALOG_FILES
if [ -z "$XML_CATALOG_FILES" ]; then XML_CATALOG_FILES=" "; fi if [ -z "$XML_CATALOG_FILES" ]; then XML_CATALOG_FILES=" "; fi
envHooks+=(addXMLCatalogs) addEnvHooks "$hostOffset" addXMLCatalogs
fi fi

View file

@ -10,4 +10,4 @@ addPkgToClassPath () {
done done
} }
envHooks+=(addPkgToClassPath) addEnvHooks "$targetOffset" addPkgToClassPath

View file

@ -2,4 +2,4 @@ setupDebugInfoDirs () {
addToSearchPath NIX_DEBUG_INFO_DIRS $1/lib/debug addToSearchPath NIX_DEBUG_INFO_DIRS $1/lib/debug
} }
envHooks+=(setupDebugInfoDirs) addEnvHooks "$targetOffset" setupDebugInfoDirs

View file

@ -6,7 +6,7 @@ find_gio_modules() {
fi fi
} }
envHooks+=(find_gio_modules) addEnvHooks "$targetOffset" find_gio_modules
# Note: $gappsWrapperArgs still gets defined even if $dontWrapGApps is set. # Note: $gappsWrapperArgs still gets defined even if $dontWrapGApps is set.
wrapGAppsHook() { wrapGAppsHook() {

View file

@ -8,7 +8,8 @@ hicolorIconThemeHook() {
} }
envHooks+=(hicolorIconThemeHook) # I think this is meant to be a runtime dep
addEnvHooks "$hostOffset" hicolorIconThemeHook
# Remove icon cache # Remove icon cache
hicolorPreFixupPhase() { hicolorPreFixupPhase() {

View file

@ -4,4 +4,4 @@ make_grilo_find_plugins() {
fi fi
} }
envHooks+=(make_grilo_find_plugins) addEnvHooks "$hostOffset" make_grilo_find_plugins

View file

@ -74,4 +74,4 @@ addEnvVars() {
addToSearchPath NIX_GNUSTEP_SYSTEM_DOC_INFO "$tmp" addToSearchPath NIX_GNUSTEP_SYSTEM_DOC_INFO "$tmp"
fi fi
} }
envHooks=(${envHooks[@]} addEnvVars) addEnvHooks "$targetOffset" addEnvVars

View file

@ -4,4 +4,4 @@ addChickenRepositoryPath() {
export CHICKEN_INCLUDE_PATH="$1/share;$CHICKEN_INCLUDE_PATH" export CHICKEN_INCLUDE_PATH="$1/share;$CHICKEN_INCLUDE_PATH"
} }
envHooks=(${envHooks[@]} addChickenRepositoryPath) addEnvHooks "$targetOffset" addChickenRepositoryPath

View file

@ -2,4 +2,4 @@ addToGoPath() {
addToSearchPath GOPATH $1/share/go addToSearchPath GOPATH $1/share/go
} }
envHooks=(${envHooks[@]} addToGoPath) addEnvHooks "$targetOffset" addToGoPath

View file

@ -4,4 +4,4 @@ addHaxeLibPath() {
fi fi
} }
envHooks+=(addHaxeLibPath) addEnvHooks "$targetOffset" addHaxeLibPath

View file

@ -91,7 +91,7 @@ stdenv.mkDerivation rec {
# Specifying $SBCL_HOME is only truly needed with `purgeNixReferences = true`. # Specifying $SBCL_HOME is only truly needed with `purgeNixReferences = true`.
setupHook = writeText "setupHook.sh" '' setupHook = writeText "setupHook.sh" ''
envHooks+=(_setSbclHome) addEnvHooks "$targetOffset" _setSbclHome
_setSbclHome() { _setSbclHome() {
export SBCL_HOME='@out@/lib/sbcl/' export SBCL_HOME='@out@/lib/sbcl/'
} }

View file

@ -18,7 +18,8 @@
fi fi
} }
envHooks+=(addIdrisLibs) # All run-time deps
addEnvHooks 0 addIdrisLibs
''; '';
buildPhase = '' buildPhase = ''

View file

@ -14,7 +14,7 @@
fi fi
} }
envHooks+=(installIdrisLib) envHostTargetHooks+=(installIdrisLib)
''; '';
unpackPhase = '' unpackPhase = ''

View file

@ -2,4 +2,4 @@ addErlLibPath() {
addToSearchPath ERL_LIBS $1/lib/elixir/lib addToSearchPath ERL_LIBS $1/lib/elixir/lib
} }
envHooks+=(addErlLibPath) addEnvHooks "$hostOffset" addErlLibPath

View file

@ -2,4 +2,4 @@ addErlangLibPath() {
addToSearchPath ERL_LIBS $1/lib/erlang/lib addToSearchPath ERL_LIBS $1/lib/erlang/lib
} }
envHooks+=(addErlangLibPath) addEnvHooks "$hostOffset" addErlangLibPath

View file

@ -10,4 +10,4 @@ addGuileLibPath () {
fi fi
} }
envHooks+=(addGuileLibPath) addEnvHooks "$hostOffset" addGuileLibPath

View file

@ -10,4 +10,4 @@ addGuileLibPath () {
fi fi
} }
envHooks+=(addGuileLibPath) addEnvHooks "$hostOffset" addGuileLibPath

View file

@ -5,4 +5,4 @@ addGuileLibPath () {
fi fi
} }
envHooks+=(addGuileLibPath) addEnvHooks "$hostOffset" addGuileLibPath

View file

@ -36,7 +36,7 @@ jruby = stdenv.mkDerivation rec {
addToSearchPath GEM_PATH \$1/${passthru.gemPath} addToSearchPath GEM_PATH \$1/${passthru.gemPath}
} }
envHooks+=(addGemPath) addEnvHooks "$hostOffset" addGemPath
EOF EOF
''; '';

View file

@ -2,4 +2,4 @@ addPerlLibPath () {
addToSearchPath PERL5LIB $1/lib/perl5/site_perl addToSearchPath PERL5LIB $1/lib/perl5/site_perl
} }
envHooks+=(addPerlLibPath) addEnvHooks "$hostOffset" addPerlLibPath

View file

@ -12,7 +12,7 @@ toPythonPath() {
echo $result echo $result
} }
envHooks+=(addPythonPath) addEnvHooks "$hostOffset" addPythonPath
# Determinism: The interpreter is patched to write null timestamps when compiling python files. # Determinism: The interpreter is patched to write null timestamps when compiling python files.
# This way python doesn't try to update them when we freeze timestamps in nix store. # This way python doesn't try to update them when we freeze timestamps in nix store.

View file

@ -142,7 +142,7 @@ let
addToSearchPath GEM_PATH \$1/${passthru.gemPath} addToSearchPath GEM_PATH \$1/${passthru.gemPath}
} }
envHooks+=(addGemPath) addEnvHooks "$hostOffset" addGemPath
EOF EOF
'' + opString useRailsExpress '' '' + opString useRailsExpress ''
rbConfig=$(find $out/lib/ruby -name rbconfig.rb) rbConfig=$(find $out/lib/ruby -name rbconfig.rb)

View file

@ -4,8 +4,4 @@ addSDLPath () {
fi fi
} }
if test -n "$crossConfig"; then addEnvHooks "$hostOffset" addSDLPath
crossEnvHooks+=(addSDLPath)
else
envHooks+=(addSDLPath)
fi

View file

@ -4,8 +4,4 @@ addSDL2Path () {
fi fi
} }
if test -n "$crossConfig"; then addEnvHooks "$hostOffset" addSDL2Path
crossEnvHooks+=(addSDL2Path)
else
envHooks+=(addSDL2Path)
fi

View file

@ -14,4 +14,4 @@ findGdkPixbufLoaders() {
} }
envHooks+=(findGdkPixbufLoaders) addEnvHooks "$hostOffset" findGdkPixbufLoaders

View file

@ -5,7 +5,7 @@ make_glib_find_gsettings_schemas() {
addToSearchPath GSETTINGS_SCHEMAS_PATH "$1/share/gsettings-schemas/"* addToSearchPath GSETTINGS_SCHEMAS_PATH "$1/share/gsettings-schemas/"*
fi fi
} }
envHooks+=(make_glib_find_gsettings_schemas) addEnvHooks "$hostOffset" make_glib_find_gsettings_schemas
# Install gschemas, if any, in a package-specific directory # Install gschemas, if any, in a package-specific directory
glibPreInstallPhase() { glibPreInstallPhase() {

View file

@ -11,7 +11,7 @@ make_gobject_introspection_find_gir_files() {
fi fi
} }
envHooks+=(make_gobject_introspection_find_gir_files) addEnvHooks "$hostOffset" make_gobject_introspection_find_gir_files
_multioutMoveGlibGir() { _multioutMoveGlibGir() {
moveToOutput share/gir-1.0 "${!outputDev}" moveToOutput share/gir-1.0 "${!outputDev}"

View file

@ -10,8 +10,4 @@ _grantleeEnvHook() {
propagatedUserEnvPkgs+=" $1" propagatedUserEnvPkgs+=" $1"
fi fi
} }
if [ "$crossEnv" ]; then addEnvHooks "$hostOffset" _grantleeEnvHook
crossEnvHooks+=(_grantleeEnvHook)
else
envHooks+=(_grantleeEnvHook)
fi

View file

@ -5,5 +5,5 @@ addGstreamer1LibPath () {
fi fi
} }
envHooks+=(addGstreamer1LibPath) addEnvHooks "$hostOffset" addGstreamer1LibPath

View file

@ -5,4 +5,4 @@ addGstreamerLibPath () {
fi fi
} }
envHooks+=(addGstreamerLibPath) addEnvHooks "$hostOffset" addGstreamerLibPath

View file

@ -2,7 +2,7 @@ _ecmEnvHook() {
addToSearchPath XDG_DATA_DIRS "$1/share" addToSearchPath XDG_DATA_DIRS "$1/share"
addToSearchPath XDG_CONFIG_DIRS "$1/etc/xdg" addToSearchPath XDG_CONFIG_DIRS "$1/etc/xdg"
} }
envHooks+=(_ecmEnvHook) addEnvHooks "$targetOffset" _ecmEnvHook
_ecmPreConfigureHook() { _ecmPreConfigureHook() {
# Because we need to use absolute paths here, we must set *all* the paths. # Because we need to use absolute paths here, we must set *all* the paths.

View file

@ -2,4 +2,4 @@ addXdgData() {
addToSearchPath XDG_DATA_DIRS "$1/share" addToSearchPath XDG_DATA_DIRS "$1/share"
} }
envHooks+=(addXdgData) addEnvHooks "$targetOffset" addXdgData

View file

@ -2,4 +2,4 @@ addRepDLLoadPath () {
addToSearchPath REP_DL_LOAD_PATH $1/lib/rep addToSearchPath REP_DL_LOAD_PATH $1/lib/rep
} }
envHooks+=(addRepDLLoadPath) addEnvHooks "$hostOffset" addRepDLLoadPath

View file

@ -42,11 +42,7 @@ qtEnvHook() {
propagatedUserEnvPkgs+=" $1" propagatedUserEnvPkgs+=" $1"
fi fi
} }
if [ "$crossConfig" ]; then envHostTargetHooks+=(qtEnvHook)
crossEnvHooks+=(qtEnvHook)
else
envHooks+=(qtEnvHook)
fi
postPatchMkspecs() { postPatchMkspecs() {
local bin="${!outputBin}" local bin="${!outputBin}"

View file

@ -2,4 +2,4 @@ addRepDLLoadPath () {
addToSearchPath REP_DL_LOAD_PATH $1/lib/rep addToSearchPath REP_DL_LOAD_PATH $1/lib/rep
} }
envHooks+=(addRepDLLoadPath) addEnvHooks "$hostOffset" addRepDLLoadPath

View file

@ -10,4 +10,4 @@ addSlibPath () {
fi fi
} }
envHooks+=(addSlibPath) addEnvHooks "$hostOffset" addSlibPath

View file

@ -31,7 +31,7 @@ collectNixLispLDLP () {
export NIX_LISP_COMMAND NIX_LISP CL_SOURCE_REGISTRY NIX_LISP_ASDF export NIX_LISP_COMMAND NIX_LISP CL_SOURCE_REGISTRY NIX_LISP_ASDF
envHooks+=(addASDFPaths setLisp collectNixLispLDLP) addEnvHooks "$targetOffset" addASDFPaths setLisp collectNixLispLDLP
mkdir -p "$HOME"/.cache/common-lisp || HOME="$TMP/.temp-$USER-home" mkdir -p "$HOME"/.cache/common-lisp || HOME="$TMP/.temp-$USER-home"
mkdir -p "$HOME"/.cache/common-lisp mkdir -p "$HOME"/.cache/common-lisp

View file

@ -2,4 +2,4 @@ addOcsigenDistilleryTemplate() {
addToSearchPathWithCustomDelimiter : ELIOM_DISTILLERY_PATH $1/eliom-distillery-templates addToSearchPathWithCustomDelimiter : ELIOM_DISTILLERY_PATH $1/eliom-distillery-templates
} }
envHooks+=(addOcsigenDistilleryTemplate) addEnvHooks "$hostOffset" addOcsigenDistilleryTemplate

View file

@ -2,4 +2,4 @@ addOcamlMakefile () {
export OCAMLMAKEFILE="@out@/include/OCamlMakefile" export OCAMLMAKEFILE="@out@/include/OCamlMakefile"
} }
envHooks+=(addOcamlMakefile) addEnvHooks "$targetOffset" addOcamlMakefile

View file

@ -72,11 +72,7 @@ if [ -z "$dontUseCmakeConfigure" -a -z "$configurePhase" ]; then
configurePhase=cmakeConfigurePhase configurePhase=cmakeConfigurePhase
fi fi
if [ -n "$crossConfig" ]; then addEnvHooks "$targetOffset" addCMakeParams
crossEnvHooks+=(addCMakeParams)
else
envHooks+=(addCMakeParams)
fi
makeCmakeFindLibs(){ makeCmakeFindLibs(){
isystem_seen= isystem_seen=

View file

@ -2,4 +2,4 @@ addAclocals () {
addToSearchPathWithCustomDelimiter : ACLOCAL_PATH $1/share/aclocal addToSearchPathWithCustomDelimiter : ACLOCAL_PATH $1/share/aclocal
} }
envHooks+=(addAclocals) addEnvHooks "$hostOffset" addAclocals

View file

@ -3,8 +3,4 @@ addPkgConfigPath () {
addToSearchPath PKG_CONFIG_PATH $1/share/pkgconfig addToSearchPath PKG_CONFIG_PATH $1/share/pkgconfig
} }
if test -n "$crossConfig"; then addEnvHooks "$targetOffset" addPkgConfigPath
crossEnvHooks+=(addPkgConfigPath)
else
envHooks+=(addPkgConfigPath)
fi

View file

@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
fi fi
} }
envHooks+=(addOCamlPath) addEnvHooks "$targetOffset" addOCamlPath
''; '';
meta = { meta = {

View file

@ -2,4 +2,4 @@ addNodePath () {
addToSearchPath NODE_PATH $1/lib/node_modules addToSearchPath NODE_PATH $1/lib/node_modules
} }
envHooks+=(addNodePath) addEnvHooks "$hostOffset" addNodePath

View file

@ -39,4 +39,4 @@ useSystemCoreFoundationFramework () {
export NIX_COREFOUNDATION_RPATH=/System/Library/Frameworks export NIX_COREFOUNDATION_RPATH=/System/Library/Frameworks
} }
envHooks+=(useSystemCoreFoundationFramework) addEnvHooks "$hostOffset" useSystemCoreFoundationFramework

View file

@ -7,4 +7,4 @@ noDeprecatedDeclarations() {
fi fi
} }
envHooks+=(noDeprecatedDeclarations) addEnvHooks "$hostOffset" noDeprecatedDeclarations

View file

@ -18,5 +18,5 @@ if test -z "$sgmlHookDone"; then
export ftp_proxy=http://nodtd.invalid/ export ftp_proxy=http://nodtd.invalid/
export SGML_CATALOG_FILES export SGML_CATALOG_FILES
envHooks+=(addSGMLCatalogs) addEnvHooks "$targetOffset" addSGMLCatalogs
fi fi

View file

@ -4,4 +4,4 @@ addTeXMFPath () {
fi fi
} }
envHooks+=(addTeXMFPath) addEnvHooks "$targetOffset" addTeXMFPath

View file

@ -4,4 +4,4 @@ addTeXMFPath () {
fi fi
} }
envHooks+=(addTeXMFPath) addEnvHooks "$targetOffset" addTeXMFPath