ocamlPackages.ptime: use finalAttrs pattern

This commit is contained in:
Pol Dellaiera 2023-07-31 16:13:23 +02:00
parent d213d1e173
commit 6dfbb7c89f
No known key found for this signature in database
GPG key ID: D476DFE9C67467CA
2 changed files with 27 additions and 13 deletions

View file

@ -1,28 +1,40 @@
{ stdenv, lib, fetchurl, ocaml, findlib, ocamlbuild, topkg
{ stdenv
, lib
, fetchurl
, ocaml
, findlib
, ocamlbuild
, topkg
}:
lib.throwIfNot (lib.versionAtLeast ocaml.version "4.08")
"ptime is not available for OCaml ${ocaml.version}"
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
version = "1.1.0";
pname = "ocaml${ocaml.version}-ptime";
src = fetchurl {
url = "https://erratique.ch/software/ptime/releases/ptime-${version}.tbz";
sha256 = "sha256-y/WxVFT7JxBeLDNAI+HhHY+TnXF4hw9cvo7SbfcBPrE=";
url = "https://erratique.ch/software/ptime/releases/ptime-${finalAttrs.version}.tbz";
hash = "sha256-y/WxVFT7JxBeLDNAI+HhHY+TnXF4hw9cvo7SbfcBPrE=";
};
nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
buildInputs = [ topkg ];
nativeBuildInputs = [
findlib
ocaml
ocamlbuild
topkg
];
buildInputs = [
topkg
];
strictDeps = true;
inherit (topkg) buildPhase installPhase;
meta = {
homepage = "https://erratique.ch/software/ptime";
description = "POSIX time for OCaml";
homepage = "https://erratique.ch/software/ptime";
license = lib.licenses.isc;
longDescription = ''
Ptime has platform independent POSIX time support in pure OCaml.
It provides a type to represent a well-defined range of POSIX timestamps
@ -35,7 +47,6 @@ stdenv.mkDerivation rec {
Ptime is not a calendar library.
'';
license = lib.licenses.isc;
maintainers = with lib.maintainers; [ sternenseemann ];
};
}
})

View file

@ -1433,7 +1433,10 @@ let
psq = callPackage ../development/ocaml-modules/psq { };
ptime = callPackage ../development/ocaml-modules/ptime { };
ptime =
if lib.versionAtLeast ocaml.version "4.08"
then callPackage ../development/ocaml-modules/ptime { }
else null;
ptmap = callPackage ../development/ocaml-modules/ptmap { };