{ lib, stdenv, fetchFromGitHub, coreutils, ocaml-ng, dune, zlib, pcre2, neko, mbedtls, }: let ocamlDependencies = version: with ocaml-ng.ocamlPackages; [ ocaml findlib sedlex xml-light ptmap camlp5 sha luv extlib ]; generic = { hash, version, }: stdenv.mkDerivation { pname = "haxe"; inherit version; buildInputs = [ zlib neko dune pcre2 mbedtls ] ++ ocamlDependencies version; src = fetchFromGitHub { owner = "HaxeFoundation"; repo = "haxe"; rev = version; fetchSubmodules = true; inherit hash; }; prePatch = '' substituteInPlace extra/haxelib_src/src/haxelib/client/Main.hx \ --replace-fail '"neko"' '"${neko}/bin/neko"' ''; buildFlags = [ "all" "tools" ]; installPhase = '' install -vd "$out/bin" "$out/lib/haxe/std" cp -vr haxe haxelib std "$out/lib/haxe" # make wrappers which provide a temporary HAXELIB_PATH with symlinks to multiple repositories HAXELIB_PATH may point to for name in haxe haxelib; do cat > $out/bin/$name < /dev/null cat >> InstallCheck.hx < /dev/null ''; meta = { description = "Programming language targeting JavaScript, Flash, NekoVM, PHP, C++"; homepage = "https://haxe.org"; license = with lib.licenses; [ gpl2Plus mit ]; # based on upstream opam file maintainers = [ lib.maintainers.locallycompact lib.maintainers.logo lib.maintainers.bwkam ]; platforms = lib.platforms.linux ++ lib.platforms.darwin; }; }; in { haxe_4_3 = generic { version = "4.3.7"; hash = "sha256-sQb7MCoH2dZOvNmDQ9P0yFYrSXYOMn4FS/jlyjth39Y="; }; }