about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/games/build-support/build-unity.nix42
-rw-r--r--pkgs/games/itch/invisigun-heroes.nix9
2 files changed, 20 insertions, 31 deletions
diff --git a/pkgs/games/build-support/build-unity.nix b/pkgs/games/build-support/build-unity.nix
index dfd69bba..bdca83eb 100644
--- a/pkgs/games/build-support/build-unity.nix
+++ b/pkgs/games/build-support/build-unity.nix
@@ -1,35 +1,31 @@
-{ stdenv, makeWrapper, mesa, xorg, libpulseaudio, libudev }:
+{ stdenv, buildGame, makeWrapper, gtk2-x11, gdk_pixbuf, glib
+, mesa, xorg, libpulseaudio, libudev, zlib
+}:
 
-{ name, version, fullName, buildPhase ? "", rpath ? [], ... }@attrs:
+{ name, version, fullName
+, nativeBuildInputs ? []
+, buildInputs ? []
+, runtimeDependencies ? []
+, ...
+}@attrs:
 
 let
   arch = if stdenv.system == "x86_64-linux" then "x86_64" else "x86";
   executable = "${fullName}.${arch}";
   dataDir = "${fullName}_Data";
 
-in stdenv.mkDerivation ({
+in buildGame ({
   name = "${name}-${version}";
   inherit fullName version arch executable dataDir;
   slugName = name;
 
-  nativeBuildInputs = [ makeWrapper ];
+  nativeBuildInputs = [ makeWrapper ] ++ nativeBuildInputs;
 
-  buildPhase = let
-    mainRpath = stdenv.lib.makeLibraryPath ([
-      stdenv.cc.cc mesa xorg.libX11 xorg.libXcursor xorg.libXrandr
-      libpulseaudio libudev
-    ] ++ rpath);
-  in ''
-    runHook preBuild
+  buildInputs = [ gtk2-x11 gdk_pixbuf glib ];
 
-    patchelf \
-      --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
-      --set-rpath ${stdenv.lib.escapeShellArg mainRpath} "$executable"
-
-    ${buildPhase}
-
-    runHook postBuild
-  '';
+  runtimeDependencies = [
+    mesa xorg.libX11 xorg.libXcursor xorg.libXrandr libudev zlib
+  ];
 
   installPhase = ''
     runHook preInstall
@@ -62,7 +58,7 @@ in stdenv.mkDerivation ({
 
     runHook postInstall
   '';
-
-  dontStrip = true;
-  dontPatchELF = true;
-} // removeAttrs attrs [ "name" "version" "fullName" "buildPhase" "rpath" ])
+} // removeAttrs attrs [
+  "name" "version" "fullName" "nativeBuildInputs" "buildInputs"
+  "runtimeDependencies"
+])
diff --git a/pkgs/games/itch/invisigun-heroes.nix b/pkgs/games/itch/invisigun-heroes.nix
index 4ab28f92..adbb2de3 100644
--- a/pkgs/games/itch/invisigun-heroes.nix
+++ b/pkgs/games/itch/invisigun-heroes.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, buildUnity, fetchItch, unzip, gtk2-x11, gdk_pixbuf, glib }:
+{ buildUnity, fetchItch, unzip }:
 
 buildUnity rec {
   name = "invisigun-heroes";
@@ -16,11 +16,4 @@ buildUnity rec {
   unpackCmd = ''
     ${unzip}/bin/unzip -qq -d invisigun-heroes "$src" || :
   '';
-
-  buildPhase = let
-    rpath = lib.makeLibraryPath [ stdenv.cc.cc gtk2-x11 gdk_pixbuf glib ];
-  in ''
-    patchelf --set-rpath ${lib.escapeShellArg rpath} \
-      "Invisigun Heroes_Data/Plugins/x86_64/ScreenSelector.so"
-  '';
 }