Home Explore Blog CI



nixpkgs

16th chunk of `doc/stdenv/stdenv.chapter.md`
7b98d5f1b1c27a20dd82720d148ba776a3f9c7cd869c73170000000100000fdd
A list of strings passed as additional flags to `make`. Like `makeFlags` and `makeFlagsArray`, but only used by the check phase. Unlike with `buildFlags`, the `checkTarget` is automatically added to the `make` invocation in addition to any `checkFlags` specified.

##### `checkInputs` {#var-stdenv-checkInputs}

A list of host dependencies used by the phase, usually libraries linked into executables built during tests. This gets included in `buildInputs` when `doCheck` is set.

##### `nativeCheckInputs` {#var-stdenv-nativeCheckInputs}

A list of native dependencies used by the phase, notably tools needed on `$PATH`. This gets included in `nativeBuildInputs` when `doCheck` is set.

##### `preCheck` {#var-stdenv-preCheck}

Hook executed at the start of the check phase.

##### `postCheck` {#var-stdenv-postCheck}

Hook executed at the end of the check phase.

### The install phase {#ssec-install-phase}

The install phase is responsible for installing the package in the Nix store under `out`. The default `installPhase` creates the directory `$out` and calls `make install`.

#### Variables controlling the install phase {#variables-controlling-the-install-phase}

##### `dontInstall` {#var-stdenv-dontInstall}

Set to true to skip the install phase.

##### `makeFlags` / `makeFlagsArray` / `makefile` {#makeflags-makeflagsarray-makefile-1}

See the [build phase](#var-stdenv-makeFlags) for details.

##### `installTargets` {#var-stdenv-installTargets}

The make targets that perform the installation. Defaults to `install`. Example:

```nix
{
  installTargets = "install-bin install-doc";
}
```

##### `installFlags` / `installFlagsArray` {#var-stdenv-installFlags}

A list of strings passed as additional flags to `make`. Like `makeFlags` and `makeFlagsArray`, but only used by the install phase. Unlike with `buildFlags`, the `installTargets` are automatically added to the `make` invocation in addition to any `installFlags` specified.

##### `preInstall` {#var-stdenv-preInstall}

Hook executed at the start of the install phase.

##### `postInstall` {#var-stdenv-postInstall}

Hook executed at the end of the install phase.

### The fixup phase {#ssec-fixup-phase}

The fixup phase performs (Nix-specific) post-processing actions on the files installed under `$out` by the install phase. The default `fixupPhase` does the following:

- It moves the `man/`, `doc/` and `info/` subdirectories of `$out` to `share/`.
- It strips libraries and executables of debug information.
- On Linux, it applies the `patchelf` command to ELF executables and libraries to remove unused directories from the `RPATH` in order to prevent unnecessary runtime dependencies.
- It rewrites the interpreter paths of shell scripts to paths found in `PATH`. E.g., `/usr/bin/perl` will be rewritten to `/nix/store/some-perl/bin/perl` found in `PATH`. See [](#patch-shebangs.sh) for details.

#### Variables controlling the fixup phase {#variables-controlling-the-fixup-phase}

##### `dontFixup` {#var-stdenv-dontFixup}

Set to true to skip the fixup phase.

##### `dontStrip` {#var-stdenv-dontStrip}

If set, libraries and executables are not stripped. By default, they are.

##### `dontStripHost` {#var-stdenv-dontStripHost}

Like `dontStrip`, but only affects the `strip` command targeting the package’s host platform. Useful when supporting cross compilation, but otherwise feel free to ignore.

##### `dontStripTarget` {#var-stdenv-dontStripTarget}

Like `dontStrip`, but only affects the `strip` command targeting the packages’ target platform. Useful when supporting cross compilation, but otherwise feel free to ignore.

##### `dontMoveSbin` {#var-stdenv-dontMoveSbin}

If set, files in `$out/sbin` are not moved to `$out/bin`. By default, they are.

##### `stripAllList` {#var-stdenv-stripAllList}

List of directories to search for libraries and executables from which *all* symbols should be stripped. By default, it’s empty. Stripping all symbols is risky, since it may remove not just debug symbols but also ELF information necessary for normal execution.

Title: Install and Fixup Phases in Nix: Configuration Variables and Actions
Summary
This section details the install and fixup phases within a Nix build. It explains the variables that control these phases, including `installTargets`, `installFlags`, `dontInstall`, `dontFixup`, and `dontStrip`. The install phase installs the package under `$out`, while the fixup phase performs post-processing like moving documentation, stripping debug information, and rewriting interpreter paths in shell scripts.