diff options
author | Guillaume Girol <symphorien+git@xlumurb.eu> | 2022-12-11 12:00:00 +0000 |
---|---|---|
committer | Guillaume Girol <symphorien+git@xlumurb.eu> | 2023-01-03 20:30:34 +0100 |
commit | 6043e3af4ec34a42d1f45620527eb3081e5b564a (patch) | |
tree | fef6d963842a49fa756c6d81e8edbec848818662 /pkgs/development/tools/ocaml | |
parent | 3302bc3ddda5b1f72f7382b259d25856ed763a5e (diff) | |
download | nixpkgs-6043e3af4ec34a42d1f45620527eb3081e5b564a.tar nixpkgs-6043e3af4ec34a42d1f45620527eb3081e5b564a.tar.gz nixpkgs-6043e3af4ec34a42d1f45620527eb3081e5b564a.tar.bz2 nixpkgs-6043e3af4ec34a42d1f45620527eb3081e5b564a.tar.lz nixpkgs-6043e3af4ec34a42d1f45620527eb3081e5b564a.tar.xz nixpkgs-6043e3af4ec34a42d1f45620527eb3081e5b564a.tar.zst nixpkgs-6043e3af4ec34a42d1f45620527eb3081e5b564a.zip |
ocamlPackages.findlib: detect conflicts of version early
just like pythonCatchConflictHook
Diffstat (limited to 'pkgs/development/tools/ocaml')
-rw-r--r-- | pkgs/development/tools/ocaml/findlib/default.nix | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/pkgs/development/tools/ocaml/findlib/default.nix b/pkgs/development/tools/ocaml/findlib/default.nix index 51df81cea5e..f48ce5abf3f 100644 --- a/pkgs/development/tools/ocaml/findlib/default.nix +++ b/pkgs/development/tools/ocaml/findlib/default.nix @@ -44,6 +44,15 @@ stdenv.mkDerivation rec { mkdir -p $OCAMLFIND_DESTDIR fi } + detectOcamlConflicts () { + local conflict + conflict="$(ocamlfind list |& grep "has multiple definitions" || true)" + if [[ -n "$conflict" ]]; then + echo "Conflicting ocaml packages detected"; + echo "$conflict" + exit 1 + fi + } # run for every buildInput addEnvHooks "$targetOffset" addOCamlPath @@ -51,6 +60,10 @@ stdenv.mkDerivation rec { preInstallHooks+=(createOcamlDestDir) # run even in nix-shell, and even without buildInputs addEnvHooks "$hostOffset" exportOcamlDestDir + # runs after all calls to addOCamlPath + if [[ -z "''${dontDetectOcamlConflicts-}" ]]; then + postHooks+=("detectOcamlConflicts") + fi ''; meta = { |