2020-05-20 18:07:39 +04:00
|
|
|
# An overlay that adds ligo to ocamlPackages
|
|
|
|
|
2020-03-25 22:14:18 +04:00
|
|
|
{ sources ? import ./sources.nix
|
|
|
|
, CI_COMMIT_SHA ? builtins.getEnv "CI_COMMIT_SHA"
|
|
|
|
, COMMIT_DATE ? builtins.getEnv "COMMIT_DATE" }:
|
|
|
|
self: super:
|
|
|
|
let
|
|
|
|
opam-nix = import sources.opam-nix (import sources.nixpkgs { });
|
|
|
|
inherit (import sources."gitignore.nix" { inherit (self) lib; })
|
|
|
|
gitignoreSource;
|
2020-05-20 18:07:39 +04:00
|
|
|
# Remove list of directories or files from source (to stop unneeded rebuilds)
|
2020-03-25 22:14:18 +04:00
|
|
|
filterOut = xs:
|
|
|
|
self.lib.cleanSourceWith {
|
|
|
|
filter = p: type: !(builtins.elem (builtins.baseNameOf p) xs);
|
|
|
|
src = gitignoreSource ../.;
|
|
|
|
};
|
|
|
|
in {
|
|
|
|
ocamlPackages = self.ocaml-ng.ocamlPackages_4_07.overrideScope'
|
|
|
|
(builtins.foldl' self.lib.composeExtensions (_: _: { }) [
|
2020-05-20 18:07:39 +04:00
|
|
|
# Both opam-repository and tezos-opam-repository are updated manually with `niv update`
|
2020-03-25 22:14:18 +04:00
|
|
|
(opam-nix.traverseOPAMRepo' sources.opam-repository)
|
|
|
|
(opam-nix.traverseOPAMRepo sources.tezos-opam-repository)
|
|
|
|
(opam-nix.callOPAMPackage (filterOut [
|
|
|
|
".git"
|
|
|
|
".gitlab-ci.yml"
|
|
|
|
".gitignore"
|
|
|
|
"nix"
|
|
|
|
"docker"
|
|
|
|
"tools"
|
|
|
|
"gitlab-pages"
|
|
|
|
]))
|
|
|
|
(oself: osuper: {
|
2020-05-20 18:07:39 +04:00
|
|
|
# Strange naming in nixpkgs
|
2020-03-25 22:14:18 +04:00
|
|
|
ocamlfind = oself.findlib;
|
|
|
|
lablgtk = null;
|
|
|
|
lwt = oself.lwt4;
|
|
|
|
|
2020-05-20 18:07:39 +04:00
|
|
|
# Native dependencies
|
2020-03-25 22:14:18 +04:00
|
|
|
conf-gmp = self.gmp;
|
|
|
|
conf-libev = self.libev;
|
|
|
|
conf-hidapi = self.hidapi;
|
|
|
|
conf-pkg-config = self.pkg-config;
|
|
|
|
|
2020-05-20 18:07:39 +04:00
|
|
|
# Strange problems
|
2020-03-25 22:14:18 +04:00
|
|
|
bigstring = osuper.bigstring.overrideAttrs (_: { doCheck = false; });
|
|
|
|
xmldiff = osuper.xmldiff.overrideAttrs (_: { src = sources.xmldiff; });
|
|
|
|
getopt = osuper.getopt.overrideAttrs (_: { configurePhase = "true"; });
|
|
|
|
|
2020-05-20 18:07:39 +04:00
|
|
|
# Force certain versions
|
2020-03-25 22:14:18 +04:00
|
|
|
ipaddr = osuper.ipaddr.versions."4.0.0";
|
|
|
|
conduit = osuper.conduit.versions."2.1.0";
|
|
|
|
conduit-lwt-unix = osuper.conduit-lwt-unix.versions."2.0.2";
|
|
|
|
cohttp-lwt-unix = osuper.cohttp-lwt-unix.versions."2.4.0";
|
|
|
|
cohttp-lwt = osuper.cohttp-lwt.versions."2.4.0";
|
|
|
|
macaddr = osuper.macaddr.versions."4.0.0";
|
|
|
|
ocaml-migrate-parsetree =
|
|
|
|
osuper.ocaml-migrate-parsetree.versions."1.4.0";
|
|
|
|
ppx_tools_versioned = osuper.ppx_tools_versioned.versions."5.2.3";
|
|
|
|
bisect_ppx = osuper.bisect_ppx.versions."2.0.0".overrideAttrs (_: {
|
|
|
|
src = builtins.fetchTarball
|
|
|
|
"https://github.com/aantron/bisect_ppx/archive/02dfb10188033a26d07d23480c2bc44a3a670357.tar.gz";
|
|
|
|
});
|
|
|
|
|
|
|
|
proto-alpha-utils = osuper.proto-alpha-utils.overrideAttrs (oa: rec {
|
|
|
|
buildInputs = oa.buildInputs
|
|
|
|
++ [ oself.tezos-protocol-006-PsCARTHA-parameters ];
|
|
|
|
propagatedBuildInputs = buildInputs;
|
|
|
|
});
|
|
|
|
tezos-protocol-compiler = osuper.tezos-protocol-compiler.overrideAttrs
|
|
|
|
(oa: rec {
|
|
|
|
buildInputs = oa.buildInputs ++ [ oself.pprint ];
|
|
|
|
propagatedBuildInputs = buildInputs;
|
|
|
|
});
|
|
|
|
|
2020-05-20 18:07:39 +04:00
|
|
|
# A combination of executables, libraries, documentation and test coverage
|
2020-03-25 22:14:18 +04:00
|
|
|
ligo = self.buildEnv {
|
|
|
|
name = "ligo";
|
|
|
|
paths = with oself; [
|
|
|
|
ligo-out.out
|
|
|
|
ligo-tests
|
|
|
|
ligo-doc
|
|
|
|
ligo-coverage
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2020-05-20 18:07:39 +04:00
|
|
|
# LIGO executable and public libraries
|
2020-03-25 22:14:18 +04:00
|
|
|
ligo-out = osuper.ligo.overrideAttrs (oa: {
|
|
|
|
name = "ligo-out";
|
|
|
|
inherit CI_COMMIT_SHA COMMIT_DATE;
|
|
|
|
buildInputs = oa.buildInputs
|
|
|
|
++ [ oself.UnionFind oself.Preprocessor ];
|
|
|
|
nativeBuildInputs = oa.nativeBuildInputs
|
|
|
|
++ [ self.buildPackages.rakudo ];
|
|
|
|
});
|
2020-05-20 18:07:39 +04:00
|
|
|
|
|
|
|
# LIGO test suite; output empty on purpose
|
2020-03-25 22:14:18 +04:00
|
|
|
ligo-tests = osuper.ligo.overrideAttrs (oa: {
|
|
|
|
name = "ligo-tests";
|
|
|
|
src = filterOut [
|
|
|
|
".git"
|
|
|
|
".gitlab-ci.yml"
|
|
|
|
".gitignore"
|
|
|
|
"nix"
|
|
|
|
"docker"
|
|
|
|
"tools"
|
|
|
|
];
|
|
|
|
outputs = [ "out" ];
|
|
|
|
buildPhase = "dune runtest";
|
|
|
|
nativeBuildInputs = oa.nativeBuildInputs
|
|
|
|
++ [ self.buildPackages.rakudo ];
|
|
|
|
installPhase = "mkdir $out";
|
|
|
|
});
|
2020-05-20 18:07:39 +04:00
|
|
|
# LIGO odoc documentation
|
2020-03-25 22:14:18 +04:00
|
|
|
ligo-doc = osuper.ligo.overrideAttrs (oa: {
|
|
|
|
name = "ligo-doc";
|
|
|
|
buildInputs = oa.buildInputs
|
|
|
|
++ [ oself.odoc oself.tezos-protocol-updater ];
|
|
|
|
outputs = [ "out" ];
|
|
|
|
buildPhase = "dune build @doc";
|
|
|
|
nativeBuildInputs = oa.nativeBuildInputs
|
|
|
|
++ [ self.buildPackages.rakudo ];
|
|
|
|
installPhase =
|
|
|
|
"mkdir $out; cp -r _build/default/_doc/_html/ $out/doc";
|
|
|
|
});
|
2020-05-20 18:07:39 +04:00
|
|
|
# LIGO test coverage reports
|
2020-03-25 22:14:18 +04:00
|
|
|
ligo-coverage = oself.ligo-tests.overrideAttrs (oa: {
|
|
|
|
name = "ligo-coverage";
|
|
|
|
nativeBuildInputs = oa.nativeBuildInputs
|
|
|
|
++ [ self.buildPackages.rakudo ];
|
|
|
|
buildPhase = ''
|
|
|
|
# Needed for coverage and nothing else
|
|
|
|
mkdir -p $out/share/coverage
|
|
|
|
echo "Coverage:"
|
|
|
|
BISECT_ENABLE=yes dune runtest --force
|
|
|
|
bisect-ppx-report html -o $out/share/coverage/all --title="LIGO overall test coverage"
|
|
|
|
bisect-ppx-report summary --per-file
|
|
|
|
echo "Test coverage:"
|
|
|
|
BISECT_ENABLE=yes dune runtest src/test --force
|
|
|
|
bisect-ppx-report html -o $out/share/coverage/ligo --title="LIGO test coverage"
|
|
|
|
bisect-ppx-report summary --per-file
|
|
|
|
echo "Doc coverage:"
|
|
|
|
BISECT_ENABLE=yes dune build @doc-test --force
|
|
|
|
bisect-ppx-report html -o $out/share/coverage/docs --title="LIGO doc coverage"
|
|
|
|
bisect-ppx-report summary --per-file
|
|
|
|
echo "CLI test coverage:"
|
|
|
|
BISECT_ENABLE=yes dune runtest src/bin/expect_tests
|
|
|
|
bisect-ppx-report html -o $out/share/coverage/cli --title="CLI test coverage"
|
|
|
|
bisect-ppx-report summary --per-file
|
|
|
|
'';
|
|
|
|
installPhase = "true";
|
|
|
|
});
|
|
|
|
})
|
|
|
|
]);
|
|
|
|
}
|