Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib }:
2
3lib.recursiveUpdate lib (
4 import ../rocq/extra-lib-common.nix { inherit lib; }
5 // {
6
7 /*
8 Override arguments to mkCoqDerivation for a Coq library.
9
10 This function allows you to easily override arguments to mkCoqDerivation,
11 even when they are not exposed by the Coq library directly.
12
13 Type: overrideCoqDerivation :: AttrSet -> CoqLibraryDerivation -> CoqLibraryDerivation
14
15 Example:
16
17 ```nix
18 coqPackages.lib.overrideCoqDerivation
19 {
20 defaultVersion = "9999";
21 release."9999".hash = "sha256-fDoP11rtrIM7+OLdMisv2EF7n/IbGuwFxHiPtg3qCNM=";
22 }
23 coqPackages.QuickChick;
24 ```
25
26 This example overrides the `defaultVersion` and `release` arguments that
27 are passed to `mkCoqDerivation` in the QuickChick derivation.
28
29 Note that there is a difference between using `.override` on a Coq
30 library vs this `overrideCoqDerivation` function. `.override` allows you
31 to modify arguments to the derivation itself, for instance by passing
32 different versions of dependencies:
33
34 ```nix
35 coqPackages.QuickChick.override { ssreflect = my-cool-ssreflect; }
36 ```
37
38 whereas `overrideCoqDerivation` allows you to override arguments to the
39 call to `mkCoqDerivation` in the Coq library.
40
41 Note that all Coq libraries in Nixpkgs have a `version` argument for
42 easily using a different version. So if all you want to do is use a
43 different version, and the derivation for the Coq library already has
44 support for the version you want, you likely only need to update the
45 `version` argument on the library derivation. This is done with
46 `.override`:
47
48 ```nix
49 coqPackages.QuickChick.override { version = "1.4.0"; }
50 ```
51 */
52 overrideCoqDerivation =
53 f: drv:
54 (drv.override (args: {
55 mkCoqDerivation = drv_: (args.mkCoqDerivation drv_).override f;
56 }));
57 }
58)