1 { stdenv, lib, fetchzip, fetchFromGitHub, haxe, neko, jdk, mono }:
4 withCommas = lib.replaceStrings [ "." ] [ "," ];
6 # simulate "haxelib dev $libname ."
7 simulateHaxelibDev = libname: ''
9 mkdir -p "$devrepo/${withCommas libname}"
10 echo $(pwd) > "$devrepo/${withCommas libname}/.dev"
11 export HAXELIB_PATH="$HAXELIB_PATH:$devrepo"
14 installLibHaxe = { libname, version, files ? "*" }: ''
15 mkdir -p "$out/lib/haxe/${withCommas libname}/${withCommas version}"
16 echo -n "${version}" > $out/lib/haxe/${withCommas libname}/.current
17 cp -dpR ${files} "$out/lib/haxe/${withCommas libname}/${withCommas version}/"
27 stdenv.mkDerivation (attrs // {
28 name = "${libname}-${version}";
30 buildInputs = (attrs.buildInputs or [ ]) ++ [ haxe neko ]; # for setup-hook.sh to work
32 name = "${libname}-${version}";
33 url = "http://lib.haxe.org/files/3.0/${withCommas name}.zip";
38 installPhase = attrs.installPhase or ''
41 if [ $(ls $src | wc -l) == 1 ]; then
46 ${installLibHaxe { inherit libname version; }}
52 homepage = "http://lib.haxe.org/p/${libname}";
53 license = lib.licenses.bsd2;
54 platforms = lib.platforms.all;
55 description = throw "please write meta.description";
60 format = buildHaxeLib {
63 sha256 = "sha256-5vZ7b+P74uGx0Gb7X/+jbsx5048dO/jv5nqCDtw5y/A=";
64 meta.description = "A Haxe Library for supporting different file formats";
67 heaps = buildHaxeLib {
70 sha256 = "sha256-i5EIKnph80eEEHvGXDXhIL4t4+RW7OcUV5zb2f3ItlI=";
71 meta.description = "The GPU Game Framework";
74 hlopenal = buildHaxeLib {
77 sha256 = "sha256-mJWFGBJPPAhVwsB2HzMfk4szSyjMT4aw543YhVqIan4=";
78 meta.description = "OpenAL support for Haxe/HL";
81 hlsdl = buildHaxeLib {
84 sha256 = "sha256-kmC2EMDy1mv0jFjwDj+m0CUvKal3V7uIGnMxJBRYGms=";
85 meta.description = "SDL/GL support for Haxe/HL";
88 hxcpp = buildHaxeLib rec {
91 sha256 = "1ybxcvwi4655563fjjgy6xv5c78grjxzadmi3l1ghds48k1rh50p";
93 for f in $out/lib/haxe/${withCommas libname}/${withCommas version}/{,project/libs/nekoapi/}bin/Linux{,64}/*; do
95 patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) "$f" || true
96 patchelf --set-rpath ${ lib.makeLibraryPath [ stdenv.cc.cc ] } "$f" || true
99 meta.description = "Runtime support library for the Haxe C++ backend";
102 hxjava = buildHaxeLib {
105 sha256 = "1vgd7qvsdxlscl3wmrrfi5ipldmr4xlsiwnj46jz7n6izff5261z";
106 meta.description = "Support library for the Java backend of the Haxe compiler";
107 propagatedBuildInputs = [ jdk ];
110 hxcs = buildHaxeLib {
113 sha256 = "0f5vgp2kqnpsbbkn2wdxmjf7xkl0qhk9lgl9kb8d5wdy89nac6q6";
114 meta.description = "Support library for the C# backend of the Haxe compiler";
115 propagatedBuildInputs = [ mono ];
118 hxnodejs_4 = buildHaxeLib {
119 libname = "hxnodejs";
121 sha256 = "0b7ck48nsxs88sy4fhhr0x1bc8h2ja732zzgdaqzxnh3nir0bajm";
122 meta.description = "Extern definitions for node.js 4.x";
127 libname = "hxnodejs";
130 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";