1# Meson {#meson}
2
3[Meson](https://mesonbuild.com/) is an open source meta build system meant to be
4fast and user-friendly.
5
6In Nixpkgs, meson comes with a setup hook that overrides the configure, check,
7and install phases.
8
9Being a meta build system, meson needs an accompanying backend. In the context
10of Nixpkgs, the typical companion backend is [Ninja](#ninja), that provides a
11setup hook registering ninja-based build and install phases.
12
13## Variables controlling Meson {#meson-variables-controlling}
14
15### Meson Exclusive Variables {#meson-exclusive-variables}
16
17#### `mesonFlags` {#meson-flags}
18
19Controls the flags passed to `meson setup` during configure phase.
20
21#### `mesonWrapMode` {#meson-wrap-mode}
22
23Which value is passed as
24[`-Dwrap_mode=`](https://mesonbuild.com/Builtin-options.html#core-options)
25to. In Nixpkgs the default value is `nodownload`, so that no subproject will be
26downloaded (since network access is already disabled during deployment in
27Nixpkgs).
28
29Note: Meson allows pre-population of subprojects that would otherwise be
30downloaded.
31
32#### `mesonBuildType` {#meson-build-type}
33
34Which value is passed as
35[`--buildtype`](https://mesonbuild.com/Builtin-options.html#core-options) to
36`meson setup` during configure phase. In Nixpkgs the default value is `plain`.
37
38#### `mesonAutoFeatures` {#meson-auto-features}
39
40Which value is passed as
41[`-Dauto_features=`](https://mesonbuild.com/Builtin-options.html#core-options)
42to `meson setup` during configure phase. In Nixpkgs the default value is
43`enabled`, meaning that every feature declared as "auto" by the meson scripts
44will be enabled.
45
46#### `mesonCheckFlags` {#meson-check-flags}
47
48Controls the flags passed to `meson test` during check phase.
49
50#### `mesonInstallFlags` {#meson-install-flags}
51
52Controls the flags passed to `meson install` during install phase.
53
54#### `mesonInstallTags` {#meson-install-tags}
55
56A list of installation tags passed to Meson's commandline option
57[`--tags`](https://mesonbuild.com/Installing.html#installation-tags) during
58install phase.
59
60Note: `mesonInstallTags` should be a list of strings, that will be converted to
61a comma-separated string that is recognized to `--tags`.
62Example: `mesonInstallTags = [ "emulator" "assembler" ];` will be converted to
63`--tags emulator,assembler`.
64
65#### `dontUseMesonConfigure` {#dont-use-meson-configure}
66
67When set to true, don't use the predefined `mesonConfigurePhase`.
68
69#### `dontUseMesonCheck` {#dont-use-meson-check}
70
71When set to true, don't use the predefined `mesonCheckPhase`.
72
73#### `dontUseMesonInstall` {#dont-use-meson-install}
74
75When set to true, don't use the predefined `mesonInstallPhase`.
76
77### Honored variables {#meson-honored-variables}
78
79The following variables commonly used by `stdenv.mkDerivation` are honored by
80Meson setup hook.
81
82- `prefixKey`
83- `enableParallelBuilding`