From cd7e23422b24f859d02705f1963be7a5ca93b5de Mon Sep 17 00:00:00 2001 From: Christopher Kaster Date: Fri, 17 Jul 2026 08:33:11 +0200 Subject: [PATCH] playdate: init at 3.1.0 --- pkgs/by-name/pl/playdate-sdk/package.nix | 111 ++++++++++++++++++ .../playdate-simulator-wrapper.sh | 18 +++ 2 files changed, 129 insertions(+) create mode 100644 pkgs/by-name/pl/playdate-sdk/package.nix create mode 100644 pkgs/by-name/pl/playdate-sdk/playdate-simulator-wrapper.sh diff --git a/pkgs/by-name/pl/playdate-sdk/package.nix b/pkgs/by-name/pl/playdate-sdk/package.nix new file mode 100644 index 000000000000..7d1273b27307 --- /dev/null +++ b/pkgs/by-name/pl/playdate-sdk/package.nix @@ -0,0 +1,111 @@ +{ + autoPatchelfHook, + copyDesktopItems, + curl, + fetchurl, + gsettings-desktop-schemas, + gtk3, + lib, + makeDesktopItem, + makeWrapper, + stdenv, + webkitgtk_4_1, +}: + +stdenv.mkDerivation rec { + pname = "playdate-sdk"; + version = "3.1.0"; + + src = fetchurl { + url = "https://download.panic.com/playdate_sdk/Linux/PlaydateSDK-${version}.tar.gz"; + sha256 = "sha256-yKEl3UpVY3lB9LxAsx0RotTsNHv8WS76ZqpzRi6BSZg="; + }; + + srcScript = ./playdate-simulator-wrapper.sh; + + strictDeps = true; + __structuredAttrs = true; + + nativeBuildInputs = [ + autoPatchelfHook + copyDesktopItems + makeWrapper + ]; + + buildInputs = [ + gsettings-desktop-schemas + gtk3 + webkitgtk_4_1 + ]; + + dontConfigure = true; + dontBuild = true; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/playdate-sdk + cp -r * $out/share/playdate-sdk + mkdir -p $out/bin + + #### pdc + makeWrapper $out/share/playdate-sdk/bin/pdc $out/bin/pdc \ + --run 'export PLAYDATE_SDK_PATH="''${XDG_DATA_HOME:-''$HOME/.local/share}/playdate-sdk-${version}"' + + #### pdutil + makeWrapper $out/share/playdate-sdk/bin/pdutil $out/bin/pdutil \ + --run 'export PLAYDATE_SDK_PATH="''${XDG_DATA_HOME:-''$HOME/.local/share}/playdate-sdk-${version}"' + + #### PlaydateSimulator + cp $srcScript $out/bin/PlaydateSimulator + substituteInPlace $out/bin/PlaydateSimulator \ + --subst-var-by out "$out" \ + --subst-var-by version "${version}" \ + --subst-var-by ldLibraryPath "${ + lib.makeLibraryPath [ + curl + ] + }" \ + --subst-var-by gsettingsSchemas "${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}:${gtk3}/share/gsettings-schemas/${gtk3.name}" + chmod +x $out/bin/PlaydateSimulator + + #### C API includes + mkdir -p $out/include + cp -r $out/share/playdate-sdk/C_API/pd_api $out/include/pd_api + cp $out/share/playdate-sdk/C_API/pd_api.h $out/include/pd_api.h + + #### udev rules + mkdir -p $out/etc/udev/rules.d + cp $out/share/playdate-sdk/Resources/50-playdate.rules $out/etc/udev/rules.d/ + + #### icons + install -Dm644 $out/share/playdate-sdk/Resources/date.play.simulator.svg $out/share/icons/hicolor/scalable/apps/PlaydateSimulator.svg + + runHook postInstall + ''; + + desktopItems = [ + (makeDesktopItem { + name = "PlaydateSimulator"; + exec = "PlaydateSimulator %u"; + icon = "PlaydateSimulator"; + desktopName = "Playdate Simulator"; + comment = "A toolset for developing games on the Playdate handheld console"; + categories = [ "Development" ]; + startupWMClass = "PlaydateSimulator"; + mimeTypes = [ + "application/x-playdate-game" + "x-scheme-handler/playdate-simulator" + ]; + }) + ]; + + meta = { + description = "Official SDK and development tools for the Playdate handheld console, including Lua/C APIs, simulator, and Mirror capture utility"; + homepage = "https://play.date"; + license = lib.licenses.unfree; + maintainers = with lib.maintainers; [ atomicptr ]; + platforms = [ "x86_64-linux" ]; + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; + }; +} diff --git a/pkgs/by-name/pl/playdate-sdk/playdate-simulator-wrapper.sh b/pkgs/by-name/pl/playdate-sdk/playdate-simulator-wrapper.sh new file mode 100644 index 000000000000..4fe10173e9fd --- /dev/null +++ b/pkgs/by-name/pl/playdate-sdk/playdate-simulator-wrapper.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -euo pipefail + +USER_SDK_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/playdate-sdk-@version@" +NIX_SDK_DIR="@out@/share/playdate-sdk" + +if [ ! -d "$USER_SDK_DIR" ]; then + echo "Initializing Playdate SDK workspace at $USER_SDK_DIR..." + mkdir -p "$USER_SDK_DIR" + cp -r "$NIX_SDK_DIR/." "$USER_SDK_DIR" + chmod -R u+w "$USER_SDK_DIR" +fi + +export PLAYDATE_SDK_PATH="$USER_SDK_DIR" +export LD_LIBRARY_PATH="@ldLibraryPath@" +export XDG_DATA_DIRS="@gsettingsSchemas@:${XDG_DATA_DIRS:-}" + +exec "$USER_SDK_DIR/bin/PlaydateSimulator" "$@"