From 1b3feb10442e3685ea60db844437cb596a0eb601 Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Tue, 18 Jul 2023 07:09:04 +0200 Subject: [PATCH] =?UTF-8?q?ocamlPackages.dypgen:=20init=20at=200.2=20for?= =?UTF-8?q?=20OCaml=20=E2=89=A5=204.07?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ocaml-modules/dypgen/default.nix | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/pkgs/development/ocaml-modules/dypgen/default.nix b/pkgs/development/ocaml-modules/dypgen/default.nix index f504e3d7ca46..d47b78307769 100644 --- a/pkgs/development/ocaml-modules/dypgen/default.nix +++ b/pkgs/development/ocaml-modules/dypgen/default.nix @@ -1,21 +1,26 @@ -{stdenv, lib, fetchurl, ocaml, findlib}: +{ stdenv, lib, fetchFromGitHub, fetchurl, ocaml, findlib }: -let - pname = "dypgen"; -in - -if lib.versionAtLeast ocaml.version "4.06" -then throw "${pname} is not available for OCaml ${ocaml.version}" -else +let params = + if lib.versionAtLeast ocaml.version "4.07" then rec { + version = "0.2"; + src = fetchFromGitHub { + owner = "grain-lang"; + repo = "dypgen"; + rev = version; + hash = "sha256-fKuO/e5YbA2B7XcghWl9pXxwvKw9YlhnmZDZcuKe3cs="; + }; + } else if lib.versionOlder ocaml.version "4.06" then { + version = "20120619-1"; + src = fetchurl { + url = "http://dypgen.free.fr/dypgen-20120619-1.tar.bz2"; + sha256 = "ecb53d6e469e9ec4d57ee6323ff498d45b78883ae13618492488e7c5151fdd97"; + }; + } else throw "dypgen is not available for OCaml ${ocaml.version}" +; in stdenv.mkDerivation rec { - name = "${pname}-${version}"; - version = "20120619-1"; - - src = fetchurl { - url = "http://dypgen.free.fr/dypgen-20120619-1.tar.bz2"; - sha256 = "ecb53d6e469e9ec4d57ee6323ff498d45b78883ae13618492488e7c5151fdd97"; - }; + pname = "ocaml${ocaml.version}-dypgen"; + inherit (params) src version; nativeBuildInputs = [ ocaml findlib ];