mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
doc: update Nix code snippets format
Command: `mdcr --config doc/tests/mdcr-config.toml doc/`
This commit is contained in:
parent
5d979e79ce
commit
bcea0cf344
86 changed files with 2485 additions and 1478 deletions
|
@ -11,15 +11,15 @@ the neceesary environment variables to use
|
|||
Example:
|
||||
|
||||
```nix
|
||||
{ mpiCheckPhaseHook, mpi, ... }:
|
||||
{
|
||||
# ...
|
||||
{ mpiCheckPhaseHook, mpi, ... }:
|
||||
{
|
||||
# ...
|
||||
|
||||
nativeCheckInputs = [
|
||||
openssh
|
||||
mpiCheckPhaseHook
|
||||
];
|
||||
}
|
||||
nativeCheckInputs = [
|
||||
openssh
|
||||
mpiCheckPhaseHook
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,11 @@ Given a package `foo` containing an init script `this-foo.fish` that depends on
|
|||
patch the init script for users to source without having the above dependencies in their `PATH`:
|
||||
|
||||
```nix
|
||||
{ lib, stdenv, patchRcPathFish}:
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
patchRcPathFish,
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
|
||||
# ...
|
||||
|
@ -39,7 +43,13 @@ stdenv.mkDerivation {
|
|||
];
|
||||
|
||||
postFixup = ''
|
||||
patchRcPathFish $out/bin/this-foo.fish ${lib.makeBinPath [ coreutils man which ]}
|
||||
patchRcPathFish $out/bin/this-foo.fish ${
|
||||
lib.makeBinPath [
|
||||
coreutils
|
||||
man
|
||||
which
|
||||
]
|
||||
}
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
|
|
@ -4,7 +4,11 @@
|
|||
This hook starts a PostgreSQL server during the `checkPhase`. Example:
|
||||
|
||||
```nix
|
||||
{ stdenv, postgresql, postgresqlTestHook }:
|
||||
{
|
||||
stdenv,
|
||||
postgresql,
|
||||
postgresqlTestHook,
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
|
||||
# ...
|
||||
|
@ -18,13 +22,13 @@ stdenv.mkDerivation {
|
|||
|
||||
If you use a custom `checkPhase`, remember to add the `runHook` calls:
|
||||
```nix
|
||||
checkPhase ''
|
||||
runHook preCheck
|
||||
checkPhase ''
|
||||
runHook preCheck
|
||||
|
||||
# ... your tests
|
||||
# ... your tests
|
||||
|
||||
runHook postCheck
|
||||
''
|
||||
runHook postCheck
|
||||
''
|
||||
```
|
||||
|
||||
## Variables {#sec-postgresqlTestHook-variables}
|
||||
|
|
|
@ -7,7 +7,7 @@ This hook starts a Redis server during `checkPhase`. Example:
|
|||
{
|
||||
stdenv,
|
||||
redis,
|
||||
redisTestHook
|
||||
redisTestHook,
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
|
||||
|
@ -47,7 +47,11 @@ Bash-only variables:
|
|||
Example usage:
|
||||
|
||||
```nix
|
||||
{ stdenv, redis, redisTestHook }:
|
||||
{
|
||||
stdenv,
|
||||
redis,
|
||||
redisTestHook,
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
|
||||
# ...
|
||||
|
@ -60,3 +64,4 @@ stdenv.mkDerivation {
|
|||
redisTestPort=6390;
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
|
|
@ -9,7 +9,7 @@ You use it like this:
|
|||
lib,
|
||||
stdenv,
|
||||
versionCheckHook,
|
||||
# ...
|
||||
# ...
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
|
|
|
@ -7,9 +7,10 @@ In Nixpkgs, `zig.hook` overrides the default build, check and install phases.
|
|||
## Example code snippet {#zig-hook-example-code-snippet}
|
||||
|
||||
```nix
|
||||
{ lib
|
||||
, stdenv
|
||||
, zig
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
zig,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue