[](#var-passthru-tests)). This avoids adding overhead to every build and enables us to run them independently.
#### Variables controlling the installCheck phase {#variables-controlling-the-installcheck-phase}
##### `doInstallCheck` {#var-stdenv-doInstallCheck}
Controls whether the installCheck phase is executed. By default it is skipped, but if `doInstallCheck` is set to true, the installCheck phase is usually executed. Thus you should set
```nix
{
doInstallCheck = true;
}
```
in the derivation to enable install checks. The exception is cross compilation. Cross compiled builds never run tests, no matter how `doInstallCheck` is set, as the newly-built program won’t run on the platform used to build it.
##### `installCheckTarget` {#var-stdenv-installCheckTarget}
The make target that runs the install tests. Defaults to `installcheck`.
##### `installCheckFlags` / `installCheckFlagsArray` {#var-stdenv-installCheckFlags}
A list of strings passed as additional flags to `make`. Like `makeFlags` and `makeFlagsArray`, but only used by the installCheck phase.
##### `installCheckInputs` {#var-stdenv-installCheckInputs}
A list of host dependencies used by the phase, usually libraries linked into executables built during tests. This gets included in `buildInputs` when `doInstallCheck` is set.
##### `nativeInstallCheckInputs` {#var-stdenv-nativeInstallCheckInputs}
A list of native dependencies used by the phase, notably tools needed on `$PATH`. This gets included in `nativeBuildInputs` when `doInstallCheck` is set.
##### `preInstallCheck` {#var-stdenv-preInstallCheck}
Hook executed at the start of the installCheck phase.
##### `postInstallCheck` {#var-stdenv-postInstallCheck}
Hook executed at the end of the installCheck phase.
### The distribution phase {#ssec-distribution-phase}
The distribution phase is intended to produce a source distribution of the package. The default `distPhase` first calls `make dist`, then it copies the resulting source tarballs to `$out/tarballs/`. This phase is only executed if the attribute `doDist` is set.
#### Variables controlling the distribution phase {#variables-controlling-the-distribution-phase}
##### `doDist` {#var-stdenv-doDist}
If set, the distribution phase is executed.
##### `distTarget` {#var-stdenv-distTarget}
The make target that produces the distribution. Defaults to `dist`.
##### `distFlags` / `distFlagsArray` {#var-stdenv-distFlags}
Additional flags passed to `make`.
##### `tarballs` {#var-stdenv-tarballs}
The names of the source distribution files to be copied to `$out/tarballs/`. It can contain shell wildcards. The default is `*.tar.gz`.
##### `dontCopyDist` {#var-stdenv-dontCopyDist}
If set, no files are copied to `$out/tarballs/`.
##### `preDist` {#var-stdenv-preDist}
Hook executed at the start of the distribution phase.
##### `postDist` {#var-stdenv-postDist}
Hook executed at the end of the distribution phase.
## Shell functions and utilities {#ssec-stdenv-functions}
The standard environment provides a number of useful functions.
### `makeWrapper` \<executable\> \<wrapperfile\> \<args\> {#fun-makeWrapper}
Constructs a wrapper for a program with various possible arguments. It is defined as part of 2 setup-hooks named `makeWrapper` and `makeBinaryWrapper` that implement the same bash functions. Hence, to use it you have to add `makeWrapper` to your `nativeBuildInputs`. Here's an example usage:
```bash
# adds `FOOBAR=baz` to `$out/bin/foo`’s environment
makeWrapper $out/bin/foo $wrapperfile --set FOOBAR baz
# Prefixes the binary paths of `hello` and `git`
# and suffixes the binary path of `xdg-utils`.
# Be advised that paths often should be patched in directly
# (via string replacements or in `configurePhase`).
makeWrapper $out/bin/foo $wrapperfile \
--prefix PATH : ${lib.makeBinPath [ hello git ]} \
--suffix PATH : ${lib.makeBinPath [ xdg-utils ]}
```
Packages may expect or require other utilities to be available at runtime.
`makeWrapper` can be used to add packages to a `PATH` environment variable local to a wrapper.