Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion doc/stdenv/stdenv.chapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,10 @@ There are a number of variables that control what phases are executed and in wha

Specifies the phases. You can change the order in which phases are executed, or add new phases, by setting this variable. If it鈥檚 not set, the default value is used, which is `$prePhases unpackPhase patchPhase $preConfigurePhases configurePhase $preBuildPhases buildPhase checkPhase $preInstallPhases installPhase fixupPhase installCheckPhase $preDistPhases distPhase $postPhases`.

The elements of `phases` must not contain spaces. If `phases` is specified as a Nix Language attribute, it should be specified as lists instead of strings. The same rules apply to the `*Phases` variables.

It is discouraged to set this variable, as it is easy to miss some important functionality hidden in some of the less obviously needed phases (like `fixupPhase` which patches the shebang of scripts).
Usually, if you just want to add a few phases, it鈥檚 more convenient to set one of the variables below (such as `preInstallPhases`).
Usually, if you just want to add a few phases, it鈥檚 more convenient to set one of the `*Phases` variables below.

##### `prePhases` {#var-stdenv-prePhases}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ neovimRequireCheckHook () {
}

echo "Using neovimRequireCheckHook"
preDistPhases+=" neovimRequireCheckHook"
appendToVar preDistPhases neovimRequireCheckHook


Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ vimCommandCheckHook () {
}

echo "Using vimCommandCheckHook"
preDistPhases+=" vimCommandCheckHook"
appendToVar preDistPhases vimCommandCheckHook

4 changes: 2 additions & 2 deletions pkgs/applications/graphics/gimp/plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let
pluginDerivation = attrs: let
name = attrs.name or "${attrs.pname}-${attrs.version}";
in stdenv.mkDerivation ({
prePhases = "extraLib";
prePhases = [ "extraLib" ];
extraLib = ''
installScripts(){
mkdir -p $out/${gimp.targetScriptDir}/${name};
Expand Down Expand Up @@ -54,7 +54,7 @@ let
});

scriptDerivation = {src, ...}@attrs : pluginDerivation ({
prePhases = "extraLib";
prePhases = [ "extraLib" ];
dontUnpack = true;
installPhase = ''
runHook preInstall
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/coq/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ stdenv.mkDerivation (removeAttrs ({
})
// (optionalAttrs (args?useMelquiondRemake) rec {
COQUSERCONTRIB = "$out/lib/coq/${coq.coq-version}/user-contrib";
preConfigurePhases = "autoconf";
preConfigurePhases = [ "autoconf" ];
configureFlags = [ "--libdir=${COQUSERCONTRIB}/${useMelquiondRemake.logpath or ""}" ];
buildPhase = "./remake -j$NIX_BUILD_CORES";
installPhase = "./remake install";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/make-darwin-bundle/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ writeShellScript "make-darwin-bundle-${name}" (''
${writeDarwinBundle}/bin/write-darwin-bundle "''${!outputBin}" "${name}" "${exec}"
}

preDistPhases+=" makeDarwinBundlePhase"
appendToVar preDistPhases makeDarwinBundlePhase
'')
2 changes: 1 addition & 1 deletion pkgs/build-support/release/binary-tarball.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ stdenv.mkDerivation (

prefix = "/usr/local";

postPhases = "finalPhase";
postPhases = [ "finalPhase" ];
}

// args //
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/release/debian-build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (

prefix = "/usr";

prePhases = "installExtraDebsPhase sysInfoPhase";
prePhases = [ "installExtraDebsPhase" "sysInfoPhase" ];
}

// removeAttrs args ["vmTools" "lib"] //
Expand Down
4 changes: 2 additions & 2 deletions pkgs/build-support/release/source-tarball.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ stdenv.mkDerivation (

showBuildStats = true;

preConfigurePhases = "autoconfPhase";
postPhases = "finalPhase";
preConfigurePhases = [ "autoconfPhase" ];
postPhases = [ "finalPhase" ];

# Autoconfiscate the sources.
autoconfPhase = ''
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/setup-hooks/autoreconf.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
preConfigurePhases="${preConfigurePhases:-} autoreconfPhase"
appendToVar preConfigurePhases autoreconfPhase

autoreconfPhase() {
runHook preAutoreconf
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
postPhases+=" cleanupBuildDir"
appendToVar postPhases cleanupBuildDir

# Force GCC to build with coverage instrumentation. Also disable
# optimisation, since it may confuse things.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/setup-hooks/keep-build-tree.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
prePhases+=" moveBuildDir"
appendToVar prePhases moveBuildDir

moveBuildDir() {
mkdir -p $out/.build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
postPhases+=" coverageReportPhase"
appendToVar postPhases coverageReportPhase

coverageReportPhase() {
lcov --directory . --capture --output-file app.info
Expand Down
4 changes: 2 additions & 2 deletions pkgs/build-support/setup-hooks/move-build-tree.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
prePhases+=" moveBuildDir"
appendToVar prePhases moveBuildDir

moveBuildDir() {
mkdir -p $out/.build
cd $out/.build
}

postPhases+=" removeBuildDir"
appendToVar postPhases removeBuildDir

removeBuildDir() {
rm -rf $out/.build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
preConfigurePhases+=" updateAutotoolsGnuConfigScriptsPhase"
appendToVar preConfigurePhases updateAutotoolsGnuConfigScriptsPhase

updateAutotoolsGnuConfigScriptsPhase() {
if [ -n "${dontUpdateAutotoolsGnuConfigScripts-}" ]; then return; fi
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/ha/hare/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ echoCmd "HAREPATH" "$HAREPATH"
echoCmd "hare" "$(command -v hare)"
echoCmd "hare-native" "$(command -v hare-native)"
'
prePhases+=("hareSetStdlibPhase" "hareInfoPhase")
appendToVar prePhases hareSetStdlibPhase hareInfoPhase

readonly hare_unconditional_flags="@hare_unconditional_flags@"
case "${hareBuildType:-"release"}" in
Expand Down
2 changes: 1 addition & 1 deletion pkgs/desktops/gnustep/make/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ addGnustepInstallFlags() {
)
}

preInstallPhases+=" addGnustepInstallFlags"
appendToVar preInstallPhases addGnustepInstallFlags

addGNUstepEnvVars() {
local filename
Expand Down
2 changes: 1 addition & 1 deletion pkgs/desktops/xfce/core/xfce4-dev-tools/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ xdtAutogenPhase() {
}

if [ -z "${dontUseXdtAutogenPhase-}" ]; then
preConfigurePhases+=(xdtAutogenPhase)
appendToVar preConfigurePhases xdtAutogenPhase
fi
4 changes: 2 additions & 2 deletions pkgs/development/compilers/dotnet/dotnet-sdk-setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ configureNuget() {
}

if [[ -z ${dontConfigureNuget-} ]]; then
prePhases+=(createNugetDirs)
preConfigurePhases+=(configureNuget)
appendToVar prePhases createNugetDirs
appendToVar preConfigurePhases configureNuget
fi
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ octaveWriteRequiredOctavePackagesPhase() {
# Yes its a bit long...
if [ -z "${dontWriteRequiredOctavePackagesPhase-}" ]; then
echo "Using octaveWriteRequiredOctavePackagesPhase"
preDistPhases+=" octaveWriteRequiredOctavePackagesPhase"
appendToVar preDistPhases octaveWriteRequiredOctavePackagesPhase
fi
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ writeRequiredOctavePackagesPhase() {
# Yes its a bit long...
if [ -z "${dontWriteRequiredOctavePackagesPhase-}" ]; then
echo "Using writeRequiredOctavePackagesPhase"
preDistPhases+=" writeRequiredOctavePackagesPhase"
appendToVar preDistPhases writeRequiredOctavePackagesPhase
fi
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ function pytestCheckPhase() {

if [ -z "${dontUsePytestCheck-}" ] && [ -z "${installCheckPhase-}" ]; then
echo "Using pytestCheckPhase"
preDistPhases+=" pytestCheckPhase"
appendToVar preDistPhases pytestCheckPhase
fi
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ pythonCatchConflictsPhase() {
}

if [ -z "${dontUsePythonCatchConflicts-}" ]; then
preDistPhases+=" pythonCatchConflictsPhase"
appendToVar preDistPhases pythonCatchConflictsPhase
fi
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ pythonImportsCheckPhase () {

if [ -z "${dontUsePythonImportsCheck-}" ]; then
echo "Using pythonImportsCheckPhase"
preDistPhases+=" pythonImportsCheckPhase"
appendToVar preDistPhases pythonImportsCheckPhase
fi
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ pythonRecompileBytecodePhase () {
}

if [ -z "${dontUsePythonRecompileBytecode-}" ]; then
postPhases+=" pythonRecompileBytecodePhase"
appendToVar postPhases pythonRecompileBytecodePhase
fi
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ pythonRemoveBinBytecodePhase () {
}

if [ -z "${dontUsePythonRemoveBinBytecode-}" ]; then
preDistPhases+=" pythonRemoveBinBytecodePhase"
appendToVar preDistPhases pythonRemoveBinBytecodePhase
fi
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ pythonRuntimeDepsCheckHook() {

if [ -z "${dontCheckRuntimeDeps-}" ]; then
echo "Using pythonRuntimeDepsCheckHook"
preInstallPhases+=" pythonRuntimeDepsCheckHook"
appendToVar preInstallPhases pythonRuntimeDepsCheckHook
fi
2 changes: 1 addition & 1 deletion pkgs/development/interpreters/python/hooks/sphinx-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ installSphinxPhase() {
runHook postInstallSphinx
}

preDistPhases+=" buildSphinxPhase installSphinxPhase"
appendToVar preDistPhases buildSphinxPhase installSphinxPhase
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ unittestCheckPhase() {

if [ -z "${dontUseUnittestCheck-}" ] && [ -z "${installCheckPhase-}" ]; then
echo "Using unittestCheckPhase"
preDistPhases+=" unittestCheckPhase"
appendToVar preDistPhases unittestCheckPhase
fi
2 changes: 1 addition & 1 deletion pkgs/development/libraries/glib/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ addEnvHooks "$targetOffset" make_glib_find_gsettings_schemas
glibPreInstallPhase() {
makeFlagsArray+=("gsettingsschemadir=${!outputLib}/share/gsettings-schemas/$name/glib-2.0/schemas/")
}
preInstallPhases+=" glibPreInstallPhase"
appendToVar preInstallPhases glibPreInstallPhase

glibPreFixupPhase() {
# Move gschemas in case the install flag didn't help
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/liquidfun/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ stdenv.mkDerivation rec {

sourceRoot = "liquidfun/Box2D";

preConfigurePhases = "preConfigure";
preConfigurePhases = [ "preConfigure" ];

preConfigure = ''
sed -i Box2D/Common/b2Settings.h -e 's@b2_maxPolygonVertices .*@b2_maxPolygonVertices 15@'
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/qt-5/hooks/qmake-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ qmakePrePhase() {
# do the stripping ourselves (needed for separateDebugInfo)
prependToVar qmakeFlags "CONFIG+=nostrip"
}
prePhases+=" qmakePrePhase"
appendToVar prePhases qmakePrePhase

qmakeConfigurePhase() {
runHook preConfigure
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ postPatchMkspecs() {
fi
}
if [ -z "${dontPatchMkspecs-}" ]; then
postPhases="${postPhases-}${postPhases:+ }postPatchMkspecs"
appendToVar postPhases postPatchMkspecs
fi

qtPreHook() {
Expand All @@ -107,6 +107,6 @@ qtPreHook() {
exit 1
fi
}
prePhases+=" qtPreHook"
appendToVar prePhases qtPreHook

fi
2 changes: 1 addition & 1 deletion pkgs/development/libraries/qt-6/hooks/qmake-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ qmakePrePhase() {
"NIX_OUTPUT_QML=${!outputBin}/${qtQmlPrefix:?}" \
"NIX_OUTPUT_PLUGIN=${!outputBin}/${qtPluginPrefix:?}"
}
prePhases+=" qmakePrePhase"
appendToVar prePhases qmakePrePhase

qmakeConfigurePhase() {
runHook preConfigure
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/libraries/qt-6/hooks/qtbase-setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ else # Only set up Qt once.
fi
}
if [ -z "${dontPatchMkspecs-}" ]; then
postPhases="${postPhases-}${postPhases:+ }postPatchMkspecs"
appendToVar postPhases postPatchMkspecs
fi

qtPreHook() {
Expand All @@ -81,7 +81,7 @@ else # Only set up Qt once.
exit 1
fi
}
prePhases+=" qtPreHook"
appendToVar prePhases qtPreHook

addQtModulePrefix() {
addToSearchPath QT_ADDITIONAL_PACKAGES_PREFIX_PATH $1
Expand Down
15 changes: 11 additions & 4 deletions pkgs/development/python-modules/pytest-forked/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,17 @@ pytestForkedHook() {
# until we have dependency mechanism in generic builder, we need to use this ugly hack.

if [ -z "${dontUsePytestForked-}" ] && [ -z "${dontUsePytestCheck-}" ]; then
Comment thread
philiptaron marked this conversation as resolved.
if [[ " ${preDistPhases:-} " =~ " pytestCheckPhase " ]]; then
preDistPhases+=" "
preDistPhases="${preDistPhases/ pytestCheckPhase / pytestForkedHook pytestCheckPhase }"
if [[ " ${preDistPhases[*]:-} " =~ " pytestCheckPhase " ]]; then
_preDistPhases="${preDistPhases[*]} "
_preDistPhases="${_preDistPhases/ pytestCheckPhase / pytestForkedHook pytestCheckPhase }"
if [[ -n "${__structuredAttrs-}" ]]; then
preDistPhases=()
else
preDistPhases=""
fi
appendToVar preDistPhases $_preDistPhases
unset _preDistPhases
else
preDistPhases+=" pytestForkedHook"
appendToVar preDistPhases pytestForkedHook
fi
fi
15 changes: 11 additions & 4 deletions pkgs/development/python-modules/pytest-xdist/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@ pytestXdistHook() {
# until we have dependency mechanism in generic builder, we need to use this ugly hack.

if [ -z "${dontUsePytestXdist-}" ] && [ -z "${dontUsePytestCheck-}" ]; then
Comment thread
philiptaron marked this conversation as resolved.
if [[ " ${preDistPhases:-} " =~ " pytestCheckPhase " ]]; then
preDistPhases+=" "
preDistPhases="${preDistPhases/ pytestCheckPhase / pytestXdistHook pytestCheckPhase }"
if [[ " ${preDistPhases[*]:-} " =~ " pytestCheckPhase " ]]; then
_preDistPhases="${preDistPhases[*]} "
_preDistPhases="${_preDistPhases/ pytestCheckPhase / pytestXdistHook pytestCheckPhase }"
if [[ -n "${__structuredAttrs-}" ]]; then
preDistPhases=()
else
preDistPhases=""
fi
appendToVar preDistPhases $_preDistPhases
unset _preDistPhases
else
preDistPhases+=" pytestXdistHook"
appendToVar preDistPhases pytestXdistHook
fi
fi
4 changes: 2 additions & 2 deletions pkgs/development/python-modules/pytest/7.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ let
pytestcachePhase() {
find $out -name .pytest_cache -type d -exec rm -rf {} +
}
preDistPhases+=" pytestcachePhase"
appendToVar preDistPhases pytestcachePhase

# pytest generates it's own bytecode files to improve assertion messages.
# These files similar to cpython's bytecode files but are never laoded
Expand All @@ -100,7 +100,7 @@ let
# https://github.com/pytest-dev/pytest/blob/7.2.1/src/_pytest/assertion/rewrite.py#L51-L53
find $out -name "*-pytest-*.py[co]" -delete
}
preDistPhases+=" pytestRemoveBytecodePhase"
appendToVar preDistPhases pytestRemoveBytecodePhase
'';

pythonImportsCheck = [ "pytest" ];
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/python-modules/pytest/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ buildPythonPackage rec {
pytestcachePhase() {
find $out -name .pytest_cache -type d -exec rm -rf {} +
}
preDistPhases+=" pytestcachePhase"
appendToVar preDistPhases pytestcachePhase

# pytest generates it's own bytecode files to improve assertion messages.
# These files similar to cpython's bytecode files but are never laoded
Expand All @@ -97,7 +97,7 @@ buildPythonPackage rec {
# https://github.com/pytest-dev/pytest/blob/7.2.1/src/_pytest/assertion/rewrite.py#L51-L53
find $out -name "*-pytest-*.py[co]" -delete
}
preDistPhases+=" pytestRemoveBytecodePhase"
appendToVar preDistPhases pytestRemoveBytecodePhase
'';

pythonImportsCheck = [ "pytest" ];
Expand Down
Loading