2023-08-10 07:59:29 +00:00
|
|
|
# zig.hook {#zig-hook}
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
[Zig](https://ziglang.org/) is a general-purpose programming language and toolchain for maintaining robust, optimal and reusable software.
|
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
In Nixpkgs, `zig.hook` overrides the default build, check and install phases.
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
## Example code snippet {#zig-hook-example-code-snippet}
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
```nix
|
|
|
|
{ lib
|
|
|
|
, stdenv
|
2024-05-15 15:35:15 +00:00
|
|
|
, zig
|
2023-08-04 22:07:22 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
# . . .
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2024-05-15 15:35:15 +00:00
|
|
|
zig.hook
|
2023-08-04 22:07:22 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
zigBuildFlags = [ "-Dman-pages=true" ];
|
|
|
|
|
|
|
|
dontUseZigCheck = true;
|
|
|
|
|
|
|
|
# . . .
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
## Variables controlling zig.hook {#zig-hook-variables-controlling}
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
### `zig.hook` Exclusive Variables {#zig-hook-exclusive-variables}
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
The variables below are exclusive to `zig.hook`.
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
#### `dontUseZigBuild` {#dont-use-zig-build}
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
Disables using `zigBuildPhase`.
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
#### `dontUseZigCheck` {#dont-use-zig-check}
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
Disables using `zigCheckPhase`.
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
#### `dontUseZigInstall` {#dont-use-zig-install}
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
Disables using `zigInstallPhase`.
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
### Similar variables {#zig-hook-similar-variables}
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
The following variables are similar to their `stdenv.mkDerivation` counterparts.
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
| `zig.hook` Variable | `stdenv.mkDerivation` Counterpart |
|
|
|
|
|---------------------|-----------------------------------|
|
|
|
|
| `zigBuildFlags` | `buildFlags` |
|
|
|
|
| `zigCheckFlags` | `checkFlags` |
|
|
|
|
| `zigInstallFlags` | `installFlags` |
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
### Variables honored by zig.hook {#zig-hook-variables-honored}
|
2023-08-04 22:07:22 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
The following variables commonly used by `stdenv.mkDerivation` are honored by `zig.hook`.
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
- `prefixKey`
|
|
|
|
- `dontAddPrefix`
|