From f9ea6d81eaccc9760ab151e5f3c7be0f834855ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Sun, 9 Feb 2025 22:12:01 +0100 Subject: [PATCH] ut1999: on darwin, move app bundle into Applications folder and add wrapper at bin/ut1999 so `nix run` can start the app --- pkgs/by-name/ut/ut1999/package.nix | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/pkgs/by-name/ut/ut1999/package.nix b/pkgs/by-name/ut/ut1999/package.nix index 2d86e22b8cbe..3301ac5668ec 100644 --- a/pkgs/by-name/ut/ut1999/package.nix +++ b/pkgs/by-name/ut/ut1999/package.nix @@ -6,6 +6,7 @@ undmg, fetchurl, makeDesktopItem, + makeWrapper, copyDesktopItems, libarchive, imagemagick, @@ -67,7 +68,7 @@ let } .${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}"); in -stdenv.mkDerivation { +stdenv.mkDerivation (finalAttrs: { name = "ut1999"; inherit version; sourceRoot = "."; @@ -91,23 +92,32 @@ stdenv.mkDerivation { autoPatchelfHook ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ + makeWrapper undmg ]; installPhase = let outPrefix = - if stdenv.hostPlatform.isDarwin then "$out/UnrealTournament.app/Contents/MacOS" else "$out"; + if stdenv.hostPlatform.isDarwin then + "$out/Applications/UnrealTournament.app/Contents/MacOS" + else + "$out"; in '' runHook preInstall - mkdir -p $out - '' - + lib.optionalString (stdenv.hostPlatform.isLinux) '' mkdir -p $out/bin '' + + lib.optionalString (stdenv.hostPlatform.isLinux) '' + cp -r ./* $out + '' + + lib.optionalString (stdenv.hostPlatform.isDarwin) '' + mkdir -p $out/Applications/ + cp -r "UnrealTournament.app" $out/Applications/ + makeWrapper $out/Applications/UnrealTournament.app/Contents/MacOS/UnrealTournament \ + $out/bin/${finalAttrs.meta.mainProgram} + '' + '' - cp -r ${if stdenv.hostPlatform.isDarwin then "UnrealTournament.app" else "./*"} $out chmod -R 755 $out cd ${outPrefix} # NOTE: OldUnreal patch doesn't include these folders on linux but could in the future @@ -181,4 +191,4 @@ stdenv.mkDerivation { sourceProvenance = with sourceTypes; [ binaryNativeCode ]; mainProgram = "ut1999"; }; -} +})