From 9a50cae3bbc3d9c8650d01caeedfa9b8bad2d9f5 Mon Sep 17 00:00:00 2001 From: liberodark Date: Fri, 17 Jan 2025 12:02:33 +0100 Subject: [PATCH] hawkthorne-journey: init at 1.1.0 --- .../by-name/ha/hawkthorne-journey/package.nix | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 pkgs/by-name/ha/hawkthorne-journey/package.nix diff --git a/pkgs/by-name/ha/hawkthorne-journey/package.nix b/pkgs/by-name/ha/hawkthorne-journey/package.nix new file mode 100644 index 000000000000..e08ecd62b283 --- /dev/null +++ b/pkgs/by-name/ha/hawkthorne-journey/package.nix @@ -0,0 +1,96 @@ +{ + lib, + stdenv, + fetchFromGitHub, + buildGoModule, + love, + lua, + zip, + makeWrapper, + makeDesktopItem, + tmx2lua, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "hawkthorne-journey"; + version = "1.1.0"; + + src = fetchFromGitHub { + owner = "hawkthorne"; + repo = "hawkthorne-journey"; + tag = "v${finalAttrs.version}"; + hash = "sha256-RhxI2ChkFCBu2FaW2/eHT1KTTjKP++aHDktT+qQ5ooQ="; + }; + + nativeBuildInputs = [ + zip + makeWrapper + ]; + + buildInputs = [ + love + lua + tmx2lua + ]; + + buildPhase = '' + runHook preBuild + + # Convert TMX maps to Lua + for tmxfile in src/maps/*.tmx; do + ${tmx2lua}/bin/tmx2lua "$tmxfile" + done + + # Create the .love file + cd src + zip -X -r ../hawkthorne.love . \ + -x ".*" \ + -x "*.DS_Store" \ + -x "psds/*" \ + -x "test/*" \ + -x "*.tmx" \ + -x "maps/test-level.lua" \ + -x "*/full_soundtrack.ogg" \ + -x "*.bak" + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + cd .. + mkdir -p $out/share/games/hawkthorne + cp hawkthorne.love $out/share/games/hawkthorne/ + + mkdir -p $out/bin + makeWrapper ${love}/bin/love $out/bin/hawkthorne \ + --add-flags "$out/share/games/hawkthorne/hawkthorne.love" + + mkdir -p $out/share/applications + cp ${finalAttrs.desktopItem}/share/applications/* $out/share/applications/ + + runHook postInstall + ''; + + desktopItem = makeDesktopItem { + name = "hawkthorne"; + exec = "hawkthorne"; + icon = "hawkthorne"; + desktopName = "Journey to the Center of Hawkthorne"; + genericName = "Platform Game"; + categories = [ + "Game" + "ArcadeGame" + ]; + }; + + meta = { + description = "Journey to the Center of Hawkthorne - Community Fan Game"; + homepage = "https://projecthawkthorne.com"; + changelog = "https://github.com/hawkthorne/hawkthorne-journey/releases/tag/v${finalAttrs.version}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ liberodark ]; + mainProgram = "hawkthorne"; + }; +})