From 9a50cae3bbc3d9c8650d01caeedfa9b8bad2d9f5 Mon Sep 17 00:00:00 2001 From: liberodark Date: Fri, 17 Jan 2025 12:02:33 +0100 Subject: [PATCH 1/3] 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"; + }; +}) From 54224cf56a75e36551e7564e8e4c94c6d4ddf09f Mon Sep 17 00:00:00 2001 From: liberodark Date: Fri, 17 Jan 2025 20:10:13 +0100 Subject: [PATCH 2/3] tmx2lua: init at 1.0.1 --- pkgs/by-name/tm/tmx2lua/package.nix | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 pkgs/by-name/tm/tmx2lua/package.nix diff --git a/pkgs/by-name/tm/tmx2lua/package.nix b/pkgs/by-name/tm/tmx2lua/package.nix new file mode 100644 index 000000000000..cf73eeff6eae --- /dev/null +++ b/pkgs/by-name/tm/tmx2lua/package.nix @@ -0,0 +1,28 @@ +{ + lib, + buildGoModule, + fetchFromGitHub, +}: + +buildGoModule rec { + pname = "tmx2lua"; + version = "1.0.1"; + + src = fetchFromGitHub { + owner = "hawkthorne"; + repo = "tmx2lua"; + tag = "v${version}"; + hash = "sha256-vORmsr1hcdPzZYZZJ9GTOJ5B/fT2sp47Kc1dzbgDW9M="; + }; + + vendorHash = "sha256-Vfr5/lhpb+Qdhi4Z/yCbUUyd5DvI3z8UfUfxx+975iQ="; + + meta = { + description = "Convert TMX files to Lua for LÖVE"; + homepage = "https://github.com/hawkthorne/tmx2lua"; + changelog = "https://github.com/hawkthorne/tmx2lua/releases/tag/v${version}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ liberodark ]; + mainProgram = "tmx2lua"; + }; +} From c7c6b372e94ef613d98e76f1226d3fc63b65d6fb Mon Sep 17 00:00:00 2001 From: liberodark Date: Sun, 19 Jan 2025 19:53:19 +0100 Subject: [PATCH 3/3] hawkthorne-journey: Fix Desktop --- .../by-name/ha/hawkthorne-journey/package.nix | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/pkgs/by-name/ha/hawkthorne-journey/package.nix b/pkgs/by-name/ha/hawkthorne-journey/package.nix index e08ecd62b283..9d8ee57c9306 100644 --- a/pkgs/by-name/ha/hawkthorne-journey/package.nix +++ b/pkgs/by-name/ha/hawkthorne-journey/package.nix @@ -2,12 +2,12 @@ lib, stdenv, fetchFromGitHub, - buildGoModule, love, lua, zip, makeWrapper, makeDesktopItem, + copyDesktopItems, tmx2lua, }: @@ -25,6 +25,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ zip makeWrapper + copyDesktopItems ]; buildInputs = [ @@ -38,7 +39,7 @@ stdenv.mkDerivation (finalAttrs: { # Convert TMX maps to Lua for tmxfile in src/maps/*.tmx; do - ${tmx2lua}/bin/tmx2lua "$tmxfile" + tmx2lua "$tmxfile" done # Create the .love file @@ -67,23 +68,22 @@ stdenv.mkDerivation (finalAttrs: { 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" - ]; - }; + desktopItems = [ + (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";