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