about summary refs log tree commit diff
path: root/pkgs/top-level
diff options
context:
space:
mode:
authorNorbert Melzer <timmelzer@gmail.com>2023-04-02 10:48:20 +0200
committerGitHub <noreply@github.com>2023-04-02 10:48:20 +0200
commit1f0039854072a405f7c964c428006c391a58d8e9 (patch)
tree6646332f34ec5b3a5a97fc581250d8f96e3a4f08 /pkgs/top-level
parentf845fda7e9e084d1f414647150b89a2146a3db3b (diff)
parent17d559f6a7c7ffd18da3bf8456f50da4bc506b11 (diff)
Merge pull request #224322 from Infinidoge/refactor/haxePackages
Diffstat (limited to 'pkgs/top-level')
-rw-r--r--pkgs/top-level/haxe-packages.nix229
1 files changed, 114 insertions, 115 deletions
diff --git a/pkgs/top-level/haxe-packages.nix b/pkgs/top-level/haxe-packages.nix
index 82ad280380c43..e3221412aaa10 100644
--- a/pkgs/top-level/haxe-packages.nix
+++ b/pkgs/top-level/haxe-packages.nix
@@ -1,133 +1,133 @@
 { stdenv, lib, fetchzip, fetchFromGitHub, haxe, neko, jdk, mono }:
 
 let
-  self = haxePackages;
-  haxePackages = with self; {
-
-    withCommas = lib.replaceStrings ["."] [","];
-
-    # simulate "haxelib dev $libname ."
-    simulateHaxelibDev = libname: ''
-      devrepo=$(mktemp -d)
-      mkdir -p "$devrepo/${withCommas libname}"
-      echo $(pwd) > "$devrepo/${withCommas libname}/.dev"
-      export HAXELIB_PATH="$HAXELIB_PATH:$devrepo"
-    '';
-
-    installLibHaxe = { libname, version, files ? "*" }: ''
-      mkdir -p "$out/lib/haxe/${withCommas libname}/${withCommas version}"
-      echo -n "${version}" > $out/lib/haxe/${withCommas libname}/.current
-      cp -dpR ${files} "$out/lib/haxe/${withCommas libname}/${withCommas version}/"
-    '';
-
-    buildHaxeLib = {
-      libname,
-      version,
-      sha256,
-      meta,
-      ...
+  withCommas = lib.replaceStrings [ "." ] [ "," ];
+
+  # simulate "haxelib dev $libname ."
+  simulateHaxelibDev = libname: ''
+    devrepo=$(mktemp -d)
+    mkdir -p "$devrepo/${withCommas libname}"
+    echo $(pwd) > "$devrepo/${withCommas libname}/.dev"
+    export HAXELIB_PATH="$HAXELIB_PATH:$devrepo"
+  '';
+
+  installLibHaxe = { libname, version, files ? "*" }: ''
+    mkdir -p "$out/lib/haxe/${withCommas libname}/${withCommas version}"
+    echo -n "${version}" > $out/lib/haxe/${withCommas libname}/.current
+    cp -dpR ${files} "$out/lib/haxe/${withCommas libname}/${withCommas version}/"
+  '';
+
+  buildHaxeLib =
+    { libname
+    , version
+    , sha256
+    , meta
+    , ...
     } @ attrs:
-      stdenv.mkDerivation (attrs // {
-        name = "${libname}-${version}";
-
-        buildInputs = (attrs.buildInputs or []) ++ [ haxe neko ]; # for setup-hook.sh to work
-        src = fetchzip rec {
-          name = "${libname}-${version}";
-          url = "http://lib.haxe.org/files/3.0/${withCommas name}.zip";
-          inherit sha256;
-          stripRoot = false;
-        };
+    stdenv.mkDerivation (attrs // {
+      name = "${libname}-${version}";
 
-        installPhase = attrs.installPhase or ''
-          runHook preInstall
-          (
-            if [ $(ls $src | wc -l) == 1 ]; then
-              cd $src/* || cd $src
-            else
-              cd $src
-            fi
-            ${installLibHaxe { inherit libname version; }}
-          )
-          runHook postInstall
-        '';
+      buildInputs = (attrs.buildInputs or [ ]) ++ [ haxe neko ]; # for setup-hook.sh to work
+      src = fetchzip rec {
+        name = "${libname}-${version}";
+        url = "http://lib.haxe.org/files/3.0/${withCommas name}.zip";
+        inherit sha256;
+        stripRoot = false;
+      };
 
-        meta = {
-          homepage = "http://lib.haxe.org/p/${libname}";
-          license = lib.licenses.bsd2;
-          platforms = lib.platforms.all;
-          description = throw "please write meta.description";
-        } // attrs.meta;
-      });
+      installPhase = attrs.installPhase or ''
+        runHook preInstall
+        (
+          if [ $(ls $src | wc -l) == 1 ]; then
+            cd $src/* || cd $src
+          else
+            cd $src
+          fi
+          ${installLibHaxe { inherit libname version; }}
+        )
+        runHook postInstall
+      '';
 
-    format = buildHaxeLib {
-      libname = "format";
-      version = "3.5.0";
-      sha256 = "sha256-5vZ7b+P74uGx0Gb7X/+jbsx5048dO/jv5nqCDtw5y/A=";
-      meta.description = "A Haxe Library for supporting different file formats";
-    };
+      meta = {
+        homepage = "http://lib.haxe.org/p/${libname}";
+        license = lib.licenses.bsd2;
+        platforms = lib.platforms.all;
+        description = throw "please write meta.description";
+      } // attrs.meta;
+    });
+in
+{
+  format = buildHaxeLib {
+    libname = "format";
+    version = "3.5.0";
+    sha256 = "sha256-5vZ7b+P74uGx0Gb7X/+jbsx5048dO/jv5nqCDtw5y/A=";
+    meta.description = "A Haxe Library for supporting different file formats";
+  };
 
-    heaps = buildHaxeLib {
-      libname = "heaps";
-      version = "1.9.1";
-      sha256 = "sha256-i5EIKnph80eEEHvGXDXhIL4t4+RW7OcUV5zb2f3ItlI=";
-      meta.description = "The GPU Game Framework";
-    };
+  heaps = buildHaxeLib {
+    libname = "heaps";
+    version = "1.9.1";
+    sha256 = "sha256-i5EIKnph80eEEHvGXDXhIL4t4+RW7OcUV5zb2f3ItlI=";
+    meta.description = "The GPU Game Framework";
+  };
 
-    hlopenal = buildHaxeLib {
-      libname = "hlopenal";
-      version = "1.5.0";
-      sha256 = "sha256-mJWFGBJPPAhVwsB2HzMfk4szSyjMT4aw543YhVqIan4=";
-      meta.description = "OpenAL support for Haxe/HL";
-    };
+  hlopenal = buildHaxeLib {
+    libname = "hlopenal";
+    version = "1.5.0";
+    sha256 = "sha256-mJWFGBJPPAhVwsB2HzMfk4szSyjMT4aw543YhVqIan4=";
+    meta.description = "OpenAL support for Haxe/HL";
+  };
 
-    hlsdl = buildHaxeLib {
-      libname = "hlsdl";
-      version = "1.10.0";
-      sha256 = "sha256-kmC2EMDy1mv0jFjwDj+m0CUvKal3V7uIGnMxJBRYGms=";
-      meta.description = "SDL/GL support for Haxe/HL";
-    };
+  hlsdl = buildHaxeLib {
+    libname = "hlsdl";
+    version = "1.10.0";
+    sha256 = "sha256-kmC2EMDy1mv0jFjwDj+m0CUvKal3V7uIGnMxJBRYGms=";
+    meta.description = "SDL/GL support for Haxe/HL";
+  };
 
-    hxcpp = buildHaxeLib rec {
-      libname = "hxcpp";
-      version = "4.1.15";
-      sha256 = "1ybxcvwi4655563fjjgy6xv5c78grjxzadmi3l1ghds48k1rh50p";
-      postFixup = ''
-        for f in $out/lib/haxe/${withCommas libname}/${withCommas version}/{,project/libs/nekoapi/}bin/Linux{,64}/*; do
-          chmod +w "$f"
-          patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker)   "$f" || true
-          patchelf --set-rpath ${ lib.makeLibraryPath [ stdenv.cc.cc ] }  "$f" || true
-        done
-      '';
-      meta.description = "Runtime support library for the Haxe C++ backend";
-    };
+  hxcpp = buildHaxeLib rec {
+    libname = "hxcpp";
+    version = "4.1.15";
+    sha256 = "1ybxcvwi4655563fjjgy6xv5c78grjxzadmi3l1ghds48k1rh50p";
+    postFixup = ''
+      for f in $out/lib/haxe/${withCommas libname}/${withCommas version}/{,project/libs/nekoapi/}bin/Linux{,64}/*; do
+        chmod +w "$f"
+        patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker)   "$f" || true
+        patchelf --set-rpath ${ lib.makeLibraryPath [ stdenv.cc.cc ] }  "$f" || true
+      done
+    '';
+    meta.description = "Runtime support library for the Haxe C++ backend";
+  };
 
-    hxjava = buildHaxeLib {
-      libname = "hxjava";
-      version = "3.2.0";
-      sha256 = "1vgd7qvsdxlscl3wmrrfi5ipldmr4xlsiwnj46jz7n6izff5261z";
-      meta.description = "Support library for the Java backend of the Haxe compiler";
-      propagatedBuildInputs = [ jdk ];
-    };
+  hxjava = buildHaxeLib {
+    libname = "hxjava";
+    version = "3.2.0";
+    sha256 = "1vgd7qvsdxlscl3wmrrfi5ipldmr4xlsiwnj46jz7n6izff5261z";
+    meta.description = "Support library for the Java backend of the Haxe compiler";
+    propagatedBuildInputs = [ jdk ];
+  };
 
-    hxcs = buildHaxeLib {
-      libname = "hxcs";
-      version = "3.4.0";
-      sha256 = "0f5vgp2kqnpsbbkn2wdxmjf7xkl0qhk9lgl9kb8d5wdy89nac6q6";
-      meta.description = "Support library for the C# backend of the Haxe compiler";
-      propagatedBuildInputs = [ mono ];
-    };
+  hxcs = buildHaxeLib {
+    libname = "hxcs";
+    version = "3.4.0";
+    sha256 = "0f5vgp2kqnpsbbkn2wdxmjf7xkl0qhk9lgl9kb8d5wdy89nac6q6";
+    meta.description = "Support library for the C# backend of the Haxe compiler";
+    propagatedBuildInputs = [ mono ];
+  };
 
-    hxnodejs_4 = buildHaxeLib {
-      libname = "hxnodejs";
-      version = "4.0.9";
-      sha256 = "0b7ck48nsxs88sy4fhhr0x1bc8h2ja732zzgdaqzxnh3nir0bajm";
-      meta.description = "Extern definitions for node.js 4.x";
-    };
+  hxnodejs_4 = buildHaxeLib {
+    libname = "hxnodejs";
+    version = "4.0.9";
+    sha256 = "0b7ck48nsxs88sy4fhhr0x1bc8h2ja732zzgdaqzxnh3nir0bajm";
+    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
+}