1 { stdenv, lib, fetchzip, fetchFromGitHub, haxe, neko, jdk, mono }:
5 haxePackages = with self; {
7 withCommas = lib.replaceChars ["."] [","];
9 # simulate "haxelib dev $libname ."
10 simulateHaxelibDev = libname: ''
12 mkdir -p "$devrepo/${withCommas libname}"
13 echo $(pwd) > "$devrepo/${withCommas libname}/.dev"
14 export HAXELIB_PATH="$HAXELIB_PATH:$devrepo"
17 installLibHaxe = { libname, version, files ? "*" }: ''
18 mkdir -p "$out/lib/haxe/${withCommas libname}/${withCommas version}"
19 echo -n "${version}" > $out/lib/haxe/${withCommas libname}/.current
20 cp -dpR ${files} "$out/lib/haxe/${withCommas libname}/${withCommas version}/"
30 stdenv.mkDerivation (attrs // {
31 name = "${libname}-${version}";
33 buildInputs = (attrs.buildInputs or []) ++ [ haxe neko ]; # for setup-hook.sh to work
35 name = "${libname}-${version}";
36 url = "http://lib.haxe.org/files/3.0/${withCommas name}.zip";
41 installPhase = attrs.installPhase or ''
44 if [ $(ls $src | wc -l) == 1 ]; then
49 ${installLibHaxe { inherit libname version; }}
55 homepage = "http://lib.haxe.org/p/${libname}";
56 license = lib.licenses.bsd2;
57 platforms = lib.platforms.all;
58 description = throw "please write meta.description";
62 format = buildHaxeLib {
65 sha256 = "sha256-5vZ7b+P74uGx0Gb7X/+jbsx5048dO/jv5nqCDtw5y/A=";
66 meta.description = "A Haxe Library for supporting different file formats";
69 heaps = buildHaxeLib {
72 sha256 = "sha256-i5EIKnph80eEEHvGXDXhIL4t4+RW7OcUV5zb2f3ItlI=";
73 meta.description = "The GPU Game Framework";
76 hlopenal = buildHaxeLib {
79 sha256 = "sha256-mJWFGBJPPAhVwsB2HzMfk4szSyjMT4aw543YhVqIan4=";
80 meta.description = "OpenAL support for Haxe/HL";
83 hlsdl = buildHaxeLib {
86 sha256 = "sha256-kmC2EMDy1mv0jFjwDj+m0CUvKal3V7uIGnMxJBRYGms=";
87 meta.description = "SDL/GL support for Haxe/HL";
90 hxcpp = buildHaxeLib rec {
93 sha256 = "1ybxcvwi4655563fjjgy6xv5c78grjxzadmi3l1ghds48k1rh50p";
95 for f in $out/lib/haxe/${withCommas libname}/${withCommas version}/{,project/libs/nekoapi/}bin/Linux{,64}/*; do
97 patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) "$f" || true
98 patchelf --set-rpath ${ lib.makeLibraryPath [ stdenv.cc.cc ] } "$f" || true
101 meta.description = "Runtime support library for the Haxe C++ backend";
104 hxjava = buildHaxeLib {
107 sha256 = "1vgd7qvsdxlscl3wmrrfi5ipldmr4xlsiwnj46jz7n6izff5261z";
108 meta.description = "Support library for the Java backend of the Haxe compiler";
109 propagatedBuildInputs = [ jdk ];
112 hxcs = buildHaxeLib {
115 sha256 = "0f5vgp2kqnpsbbkn2wdxmjf7xkl0qhk9lgl9kb8d5wdy89nac6q6";
116 meta.description = "Support library for the C# backend of the Haxe compiler";
117 propagatedBuildInputs = [ mono ];
120 hxnodejs_4 = buildHaxeLib {
121 libname = "hxnodejs";
123 sha256 = "0b7ck48nsxs88sy4fhhr0x1bc8h2ja732zzgdaqzxnh3nir0bajm";
124 meta.description = "Extern definitions for node.js 4.x";
128 libname = "hxnodejs";
130 in stdenv.mkDerivation {
131 name = "${libname}-${version}";
132 src = fetchFromGitHub {
133 owner = "HaxeFoundation";
136 sha256 = "0mdiacr5b2m8jrlgyd2d3vp1fha69lcfb67x4ix7l7zfi8g460gs";
138 installPhase = installLibHaxe { inherit libname version; };
140 homepage = "http://lib.haxe.org/p/${libname}";
141 license = lib.licenses.bsd2;
142 platforms = lib.platforms.all;
143 description = "Extern definitions for node.js 6.9";