mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
doc: emphasize trade-off between versionCheckHook and testers.testVersion (#344321)
This commit is contained in:
commit
d73ab2f142
2 changed files with 6 additions and 2 deletions
|
@ -1,6 +1,8 @@
|
|||
# versionCheckHook {#versioncheckhook}
|
||||
|
||||
This hook adds a `versionCheckPhase` to the [`preInstallCheckHooks`](#ssec-installCheck-phase) that runs the main program of the derivation with a `--help` or `--version` argument, and checks that the `${version}` string is found in that output. You use it like this:
|
||||
This hook adds a `versionCheckPhase` to the [`preInstallCheckHooks`](#ssec-installCheck-phase) that runs the main program of the derivation with a `--help` or `--version` argument, and checks that the `${version}` string is found in that output. If this check fails then the whole build will fail. _(A softer option is [`testers.testVersion`](#tester-testVersion).)_
|
||||
|
||||
You use it like this:
|
||||
|
||||
```nix
|
||||
{
|
||||
|
@ -33,3 +35,5 @@ The variables that this phase control are:
|
|||
- `versionCheckProgramArg`: The argument that needs to be passed to `versionCheckProgram`. If undefined the hook tries first `--help` and then `--version`. Examples: `version`, `-V`, `-v`.
|
||||
- `preVersionCheck`: A hook to run before the check is done.
|
||||
- `postVersionCheck`: A hook to run after the check is done.
|
||||
|
||||
This check assumes the executable is _hermetic_. If environment variables such as `PATH` or `HOME` are required for the program to function, then [`testers.testVersion`](#tester-testVersion) is currently the better alternative.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue