haxePackages: refactor to improve readability

This commit is contained in:
Infinidoge 2023-04-02 02:02:10 -04:00
parent 8083b23ad5
commit 17d559f6a7

View file

@ -1,9 +1,6 @@
{ stdenv, lib, fetchzip, fetchFromGitHub, haxe, neko, jdk, mono }:
let
self = haxePackages;
haxePackages = with self; {
withCommas = lib.replaceStrings [ "." ] [ "," ];
# simulate "haxelib dev $libname ."
@ -20,12 +17,12 @@ let
cp -dpR ${files} "$out/lib/haxe/${withCommas libname}/${withCommas version}/"
'';
buildHaxeLib = {
libname,
version,
sha256,
meta,
...
buildHaxeLib =
{ libname
, version
, sha256
, meta
, ...
} @ attrs:
stdenv.mkDerivation (attrs // {
name = "${libname}-${version}";
@ -58,7 +55,8 @@ let
description = throw "please write meta.description";
} // attrs.meta;
});
in
{
format = buildHaxeLib {
libname = "format";
version = "3.5.0";
@ -124,10 +122,12 @@ let
meta.description = "Extern definitions for node.js 4.x";
};
hxnodejs_6 = let
hxnodejs_6 =
let
libname = "hxnodejs";
version = "6.9.0";
in stdenv.mkDerivation {
in
stdenv.mkDerivation {
name = "${libname}-${version}";
src = fetchFromGitHub {
owner = "HaxeFoundation";
@ -143,5 +143,4 @@ let
description = "Extern definitions for node.js 6.9";
};
};
};
in self
}