nixpkgs/pkgs/development/tools/ocaml/dune-release/default.nix

60 lines
2.0 KiB
Nix
Raw Normal View History

2020-05-20 22:51:37 +01:00
{ lib, buildDunePackage, fetchurl, makeWrapper
, curly, fmt, bos, cmdliner, re, rresult, logs
2020-07-15 09:33:27 +01:00
, odoc, opam-format, opam-core, opam-state, yojson
2020-05-20 22:51:37 +01:00
, opam, git, findlib, mercurial, bzip2, gnutar, coreutils
, alcotest, mdx
}:
# don't include dune as runtime dep, so user can
# choose between dune and dune_2
let runtimeInputs = [ opam findlib git mercurial bzip2 gnutar coreutils ];
in buildDunePackage rec {
pname = "dune-release";
2020-07-15 09:33:27 +01:00
version = "1.4.0";
2020-05-20 22:51:37 +01:00
minimumOCamlVersion = "4.06";
src = fetchurl {
url = "https://github.com/ocamllabs/${pname}/releases/download/${version}/${pname}-${version}.tbz";
2020-07-15 09:33:27 +01:00
sha256 = "1frinv1rsrm30q6jclicsswpshkdwwdgxx7sp6q9w4c2p211n1ln";
2020-05-20 22:51:37 +01:00
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ curly fmt cmdliner re opam-format opam-state opam-core
2020-07-15 09:33:27 +01:00
rresult logs odoc bos yojson ];
checkInputs = [ alcotest mdx ] ++ runtimeInputs;
2020-05-20 22:51:37 +01:00
doCheck = true;
useDune2 = true;
postPatch = ''
2020-07-15 09:33:27 +01:00
# remove check for curl in PATH, since curly is patched
# to have a fixed path to the binary in nix store
2020-05-20 22:51:37 +01:00
sed -i '/must_exist (Cmd\.v "curl"/d' lib/github.ml
2020-07-15 09:33:27 +01:00
# fix problems with git invocations in tests
for f in tests/bin/{delegate_info,errors,tag,no_doc,x-commit-hash}/run.t; do
# set bogus user info in git so git commit doesn't fail
sed -i '/git init/ a \ $ git config user.name test; git config user.email "pseudo@pseudo.invalid"' "$f"
# surpress hint to set default branch name
substituteInPlace "$f" --replace "git init" "git init -b main"
done
2020-07-15 09:33:27 +01:00
# ignore weird yes error message
sed -i 's/yes |/yes 2>\/dev\/null |/' tests/bin/no_doc/run.t
2020-05-20 22:51:37 +01:00
'';
# tool specific env vars have been deprecated, use PATH
preFixup = ''
wrapProgram $out/bin/dune-release \
--prefix PATH : "${lib.makeBinPath runtimeInputs}"
'';
meta = with lib; {
description = "Release dune packages in opam";
homepage = "https://github.com/ocamllabs/dune-release";
license = licenses.isc;
maintainers = with maintainers; [ sternenseemann ];
};
}