From e559000e937f3a6c0fc9600b42c1c47dbf049e76 Mon Sep 17 00:00:00 2001 From: Matteo Pacini Date: Wed, 30 Apr 2025 23:29:32 +0100 Subject: [PATCH 1/2] gdevelop: darwin support --- pkgs/by-name/gd/gdevelop/darwin.nix | 33 ++++++++++++++++++ pkgs/by-name/gd/gdevelop/linux.nix | 41 ++++++++++++++++++++++ pkgs/by-name/gd/gdevelop/package.nix | 51 +++++++++++----------------- 3 files changed, 94 insertions(+), 31 deletions(-) create mode 100644 pkgs/by-name/gd/gdevelop/darwin.nix create mode 100644 pkgs/by-name/gd/gdevelop/linux.nix diff --git a/pkgs/by-name/gd/gdevelop/darwin.nix b/pkgs/by-name/gd/gdevelop/darwin.nix new file mode 100644 index 000000000000..9415ee4d4d37 --- /dev/null +++ b/pkgs/by-name/gd/gdevelop/darwin.nix @@ -0,0 +1,33 @@ +{ + stdenvNoCC, + fetchurl, + unzip, + + pname, + version, + meta, +}: +stdenvNoCC.mkDerivation (finalAttrs: { + inherit pname version meta; + + src = fetchurl { + url = "https://github.com/4ian/GDevelop/releases/download/v${version}/GDevelop-5-${version}-universal-mac.zip"; + hash = "sha256-0FT4JHGJKy6UapuV2tXKzWm0Esr6DPqu38PllUbUtrY="; + }; + + sourceRoot = "."; + nativeBuildInputs = [ unzip ]; + + dontPatch = true; + dontConfigure = true; + dontBuild = true; + dontFixup = true; + + installPhase = '' + runHook preInstall + mkdir -p $out/Applications + cp -r "GDevelop 5.app" $out/Applications/ + runHook postInstall + ''; + +}) diff --git a/pkgs/by-name/gd/gdevelop/linux.nix b/pkgs/by-name/gd/gdevelop/linux.nix new file mode 100644 index 000000000000..fcc51b141110 --- /dev/null +++ b/pkgs/by-name/gd/gdevelop/linux.nix @@ -0,0 +1,41 @@ +{ + stdenv, + fetchurl, + appimageTools, + + version, + pname, + meta, +}: +let + src = + if stdenv.hostPlatform.system == "x86_64-linux" then + fetchurl { + url = "https://github.com/4ian/GDevelop/releases/download/v${version}/GDevelop-5-${version}.AppImage"; + hash = "sha256-KV6gzPiu/45ibdzMG707vd10F6qLcm+afwJWa6WlywU="; + } + else + throw "${pname}-${version} is not supported on ${stdenv.hostPlatform.system}"; + appimageContents = appimageTools.extractType2 { + inherit pname version src; + postExtract = '' + substituteInPlace $out/gdevelop.desktop --replace-fail 'Exec=AppRun --no-sandbox %U' 'Exec=gdevelop' + ''; + }; +in +appimageTools.wrapType2 { + inherit + pname + version + src + meta + ; + + extraInstallCommands = '' + mkdir -p $out/share/applications + cp ${appimageContents}/gdevelop.desktop $out/share/applications + mkdir -p $out/share/icons + cp -r ${appimageContents}/usr/share/icons/hicolor $out/share/icons + ''; + +} diff --git a/pkgs/by-name/gd/gdevelop/package.nix b/pkgs/by-name/gd/gdevelop/package.nix index 5cc9ba7dc0bb..9df186bd52b9 100644 --- a/pkgs/by-name/gd/gdevelop/package.nix +++ b/pkgs/by-name/gd/gdevelop/package.nix @@ -1,39 +1,12 @@ { lib, stdenv, - fetchurl, - appimageTools, + callPackage, + ... }: let version = "5.5.229"; pname = "gdevelop"; - - src = - if stdenv.hostPlatform.system == "x86_64-linux" then - fetchurl { - url = "https://github.com/4ian/GDevelop/releases/download/v${version}/GDevelop-5-${version}.AppImage"; - sha256 = "sha256-KV6gzPiu/45ibdzMG707vd10F6qLcm+afwJWa6WlywU="; - } - else - throw "${pname}-${version} is not supported on ${stdenv.hostPlatform.system}"; - appimageContents = appimageTools.extractType2 { - inherit pname version src; - postExtract = '' - substituteInPlace $out/gdevelop.desktop --replace-fail 'Exec=AppRun --no-sandbox %U' 'Exec=gdevelop' - ''; - }; - dontPatchELF = true; -in -appimageTools.wrapType2 { - inherit pname version src; - - extraInstallCommands = '' - mkdir -p $out/share/applications - cp ${appimageContents}/gdevelop.desktop $out/share/applications - mkdir -p $out/share/icons - cp -r ${appimageContents}/usr/share/icons/hicolor $out/share/icons - ''; - meta = { description = "Graphical Game Development Studio"; homepage = "https://gdevelop.io/"; @@ -42,6 +15,22 @@ appimageTools.wrapType2 { sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; maintainers = with lib.maintainers; [ tombert ]; mainProgram = "gdevelop"; - platforms = [ "x86_64-linux" ]; + platforms = [ "x86_64-linux" ] ++ lib.platforms.darwin; }; -} +in +if stdenv.hostPlatform.isDarwin then + callPackage ./darwin.nix { + inherit + pname + version + meta + ; + } +else + callPackage ./linux.nix { + inherit + pname + version + meta + ; + } From 640dc34dac13f8a222fb2f7098a63e3514564f05 Mon Sep 17 00:00:00 2001 From: Matteo Pacini Date: Wed, 30 Apr 2025 23:30:36 +0100 Subject: [PATCH 2/2] gdevelop: add darwin maintainer --- pkgs/by-name/gd/gdevelop/package.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/gd/gdevelop/package.nix b/pkgs/by-name/gd/gdevelop/package.nix index 9df186bd52b9..c8f07e752541 100644 --- a/pkgs/by-name/gd/gdevelop/package.nix +++ b/pkgs/by-name/gd/gdevelop/package.nix @@ -13,7 +13,10 @@ let downloadPage = "https://github.com/4ian/GDevelop/releases"; license = lib.licenses.mit; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; - maintainers = with lib.maintainers; [ tombert ]; + maintainers = with lib.maintainers; [ + tombert + matteopacini + ]; mainProgram = "gdevelop"; platforms = [ "x86_64-linux" ] ++ lib.platforms.darwin; };