doc: Mention testers.hasPkgConfigModules
and its versionCheck
parameter in the appropriate section
This commit is contained in:
parent
c677c1bf9a
commit
9245f1b706
@ -7,10 +7,11 @@ Nixpkgs provides a couple of facilities for working with this tool.
|
||||
## Writing packages providing pkg-config modules {#pkg-config-writing-packages}
|
||||
|
||||
Packages should set `meta.pkgConfigModules` with the list of package config modules they provide.
|
||||
They should also use `testers.testMetaPkgConfig` to check that the final built package matches that list.
|
||||
They should also use `testers.hasPkgConfigModules` to check that the final built package matches that list,
|
||||
and optionally check that the pkgconf modules' version metadata matches the derivation's.
|
||||
Additionally, the [`validatePkgConfig` setup hook](https://nixos.org/manual/nixpkgs/stable/#validatepkgconfig), will do extra checks on to-be-installed pkg-config modules.
|
||||
|
||||
A good example of all these things is zlib:
|
||||
A good example of all these things is miniz:
|
||||
|
||||
```nix
|
||||
{ pkg-config, testers, ... }:
|
||||
@ -20,11 +21,14 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
nativeBuildInputs = [ pkg-config validatePkgConfig ];
|
||||
|
||||
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
||||
passthru.tests.pkg-config = testers.hasPkgConfigModules {
|
||||
package = finalAttrs.finalPackage;
|
||||
versionCheck = true;
|
||||
};
|
||||
|
||||
meta = {
|
||||
/* ... */
|
||||
pkgConfigModules = [ "zlib" ];
|
||||
pkgConfigModules = [ "miniz" ];
|
||||
};
|
||||
})
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user