mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-24 01:21:11 +00:00
playdate-sdk: init at 3.1.0 (#320806)
This commit is contained in:
111
pkgs/by-name/pl/playdate-sdk/package.nix
Normal file
111
pkgs/by-name/pl/playdate-sdk/package.nix
Normal file
@@ -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 ];
|
||||
};
|
||||
}
|
||||
18
pkgs/by-name/pl/playdate-sdk/playdate-simulator-wrapper.sh
Normal file
18
pkgs/by-name/pl/playdate-sdk/playdate-simulator-wrapper.sh
Normal file
@@ -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" "$@"
|
||||
Reference in New Issue
Block a user