diff --git a/pkgs/development/ocaml-modules/topkg/default.nix b/pkgs/development/ocaml-modules/topkg/default.nix index d2327b93a4f..1bd926b1ddb 100644 --- a/pkgs/development/ocaml-modules/topkg/default.nix +++ b/pkgs/development/ocaml-modules/topkg/default.nix @@ -7,11 +7,17 @@ build system is required, the attribute `run` can be used. */ { stdenv, fetchurl, ocaml, findlib, ocamlbuild, result, opaline }: -if !stdenv.lib.versionAtLeast ocaml.version "4.01" -then throw "topkg is not available for OCaml ${ocaml.version}" -else - let + param = + if stdenv.lib.versionAtLeast ocaml.version "4.03" then { + version = "1.0.3"; + sha256 = "0b77gsz9bqby8v77kfi4lans47x9p2lmzanzwins5r29maphb8y6"; + } else { + version = "1.0.0"; + sha256 = "1df61vw6v5bg2mys045682ggv058yqkqb67w7r2gz85crs04d5fw"; + propagatedBuildInputs = [ result ]; + }; + /* This command allows to run the “topkg” build system. * It is usually called with `build` or `test` as argument. * Packages that use `topkg` may call this command as part of @@ -22,15 +28,15 @@ in stdenv.mkDerivation rec { name = "ocaml${ocaml.version}-topkg-${version}"; - version = "1.0.0"; + inherit (param) version; src = fetchurl { url = "https://erratique.ch/software/topkg/releases/topkg-${version}.tbz"; - sha256 = "1df61vw6v5bg2mys045682ggv058yqkqb67w7r2gz85crs04d5fw"; + inherit (param) sha256; }; nativeBuildInputs = [ ocaml findlib ocamlbuild ]; - propagatedBuildInputs = [ result ]; + propagatedBuildInputs = param.propagatedBuildInputs or []; buildPhase = "${run} build"; createFindlibDestdir = true;