1{
2 lib,
3 buildDunePackage,
4 fetchurl,
5 makeWrapper,
6 curly,
7 fmt,
8 bos,
9 cmdliner,
10 re,
11 rresult,
12 logs,
13 fpath,
14 odoc,
15 opam-format,
16 opam-core,
17 opam-state,
18 yojson,
19 astring,
20 opam,
21 gitMinimal,
22 findlib,
23 mercurial,
24 bzip2,
25 gnutar,
26 coreutils,
27 alcotest,
28}:
29
30# don't include dune as runtime dep, so user can
31# choose between dune and dune_2
32let
33 runtimeInputs = [
34 opam
35 findlib
36 gitMinimal
37 mercurial
38 bzip2
39 gnutar
40 coreutils
41 ];
42in
43buildDunePackage rec {
44 pname = "dune-release";
45 version = "2.1.0";
46
47 src = fetchurl {
48 url = "https://github.com/ocamllabs/${pname}/releases/download/${version}/${pname}-${version}.tbz";
49 hash = "sha256-bhDf/zb6mnSB53ibb1yb8Yf1TTmVEu8rb8KUnJieCnY=";
50 };
51
52 nativeBuildInputs = [ makeWrapper ] ++ runtimeInputs;
53 buildInputs = [
54 curly
55 fmt
56 cmdliner
57 re
58 opam-format
59 opam-state
60 opam-core
61 rresult
62 logs
63 odoc
64 bos
65 yojson
66 astring
67 fpath
68 ];
69 nativeCheckInputs = [
70 odoc
71 gitMinimal
72 ];
73 checkInputs = [ alcotest ] ++ runtimeInputs;
74 doCheck = true;
75
76 postPatch = ''
77 # remove check for curl in PATH, since curly is patched
78 # to have a fixed path to the binary in nix store
79 sed -i '/must_exist (Cmd\.v "curl"/d' lib/github.ml
80 '';
81
82 preCheck = ''
83 export HOME=$TMPDIR
84 git config --global user.email "nix-builder@nixos.org"
85 git config --global user.name "Nix Builder"
86
87 # it fails when it tries to reference "./make_check_deterministic.exe"
88 rm -r tests/bin/check
89 '';
90
91 # tool specific env vars have been deprecated, use PATH
92 preFixup = ''
93 wrapProgram $out/bin/dune-release \
94 --prefix PATH : "${lib.makeBinPath runtimeInputs}"
95 '';
96
97 meta = with lib; {
98 description = "Release dune packages in opam";
99 mainProgram = "dune-release";
100 homepage = "https://github.com/ocamllabs/dune-release";
101 changelog = "https://github.com/tarides/dune-release/blob/${version}/CHANGES.md";
102 license = licenses.isc;
103 maintainers = with maintainers; [ sternenseemann ];
104 };
105}