nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 ocaml,
6 findlib,
7 pkg-config,
8 gmp,
9 version ? if lib.versionAtLeast ocaml.version "4.08" then "1.14" else "1.13",
10}:
11
12stdenv.mkDerivation (finalAttrs: {
13 pname = "ocaml${ocaml.version}-zarith";
14 inherit version;
15 src = fetchFromGitHub {
16 owner = "ocaml";
17 repo = "Zarith";
18 rev = "release-${version}";
19 hash =
20 {
21 "1.13" = "sha256-CNVKoJeO3fsmWaV/dwnUA8lgI4ZlxR/LKCXpCXUrpSg=";
22 "1.14" = "sha256-xUrBDr+M8uW2KOy7DZieO/vDgsSOnyBnpOzQDlXJ0oE=";
23 }
24 ."${finalAttrs.version}";
25 };
26
27 nativeBuildInputs = [
28 pkg-config
29 ocaml
30 findlib
31 ];
32 propagatedBuildInputs = [ gmp ];
33 strictDeps = true;
34
35 dontAddPrefix = true;
36 dontAddStaticConfigureFlags = true;
37 configurePlatforms = [ ];
38 configureFlags = [ "-installdir ${placeholder "out"}/lib/ocaml/${ocaml.version}/site-lib" ];
39
40 preInstall = "mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/stublibs";
41
42 meta = {
43 description = "Fast, arbitrary precision OCaml integers";
44 homepage = "https://github.com/ocaml/Zarith";
45 changelog = "https://github.com/ocaml/Zarith/raw/${finalAttrs.src.rev}/Changes";
46 license = lib.licenses.lgpl2;
47 inherit (ocaml.meta) platforms;
48 maintainers = with lib.maintainers; [
49 thoughtpolice
50 vbgl
51 ];
52 broken = lib.versionOlder ocaml.version "4.04";
53 };
54})