1 { lib, stdenv, fetchurl, gcc, flex, bison, texinfo, jdk_headless, erlang, makeWrapper
4 stdenv.mkDerivation rec {
9 url = "https://dl.mercurylang.org/release/mercury-srcdist-${version}.tar.gz";
10 sha256 = "sha256-oJfozI7KAVLtlSfByvc+XJyD9q2h0xOiW4D+eQcvutg=";
13 nativeBuildInputs = [ makeWrapper ];
14 buildInputs = [ gcc flex bison texinfo jdk_headless erlang readline ];
17 # Fix calls to programs in /bin
18 for p in uname pwd ; do
19 for f in $(egrep -lr /bin/$p *) ; do
20 sed -i 's@/bin/'$p'@'$p'@g' $f ;
26 mkdir -p $out/lib/mercury/cgi-bin ;
27 configureFlags="--enable-deep-profiler=$out/lib/mercury/cgi-bin";
31 # Mercury buildsystem does not take -jN directly.
32 makeFlags="PARALLEL=-j$NIX_BUILD_CORES" ;
36 # Wrap with compilers for the different targets.
37 for e in $(ls $out/bin) ; do
38 wrapProgram $out/bin/$e \
39 --prefix PATH ":" "${gcc}/bin" \
40 --prefix PATH ":" "${jdk_headless}/bin" \
41 --prefix PATH ":" "${erlang}/bin"
46 description = "A pure logic programming language";
48 Mercury is a logic/functional programming language which combines the
49 clarity and expressiveness of declarative programming with advanced
50 static analysis and error detection features. Its highly optimized
51 execution algorithm delivers efficiency far in excess of existing logic
52 programming systems, and close to conventional programming systems.
53 Mercury addresses the problems of large-scale program development,
54 allowing modularity, separate compilation, and numerous optimization/time
57 homepage = "https://mercurylang.org/";
58 changelog = "https://dl.mercurylang.org/release/release-notes-${version}.html";
59 license = lib.licenses.gpl2Only;
60 platforms = lib.platforms.all;