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..9d8ee57c9306 --- /dev/null +++ b/pkgs/by-name/ha/hawkthorne-journey/package.nix @@ -0,0 +1,96 @@ +{ + lib, + stdenv, + fetchFromGitHub, + love, + lua, + zip, + makeWrapper, + makeDesktopItem, + copyDesktopItems, + 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 + copyDesktopItems + ]; + + buildInputs = [ + love + lua + tmx2lua + ]; + + buildPhase = '' + runHook preBuild + + # Convert TMX maps to Lua + for tmxfile in src/maps/*.tmx; do + 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" + + runHook postInstall + ''; + + 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"; + 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"; + }; +}) 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"; + }; +}