From c56fec9f9fb84c846ad0e06a732cec30ac5a4192 Mon Sep 17 00:00:00 2001
From: Jacob Moody <moody@posixcafe.org>
Date: Wed, 26 Jul 2023 18:06:25 -0500
Subject: [PATCH] hheretic: init at 0.2.3

---
 pkgs/games/hheretic/default.nix | 56 +++++++++++++++++++++++++++++++++
 pkgs/top-level/all-packages.nix |  2 ++
 2 files changed, 58 insertions(+)
 create mode 100644 pkgs/games/hheretic/default.nix

diff --git a/pkgs/games/hheretic/default.nix b/pkgs/games/hheretic/default.nix
new file mode 100644
index 000000000000..73adca8928cd
--- /dev/null
+++ b/pkgs/games/hheretic/default.nix
@@ -0,0 +1,56 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, SDL
+, SDL_mixer
+, autoreconfHook
+, gitUpdater
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "hheretic";
+  version = "0.2.3";
+
+  src = fetchFromGitHub {
+    owner = "sezero";
+    repo = "hheretic";
+    rev = "hheretic-${finalAttrs.version}";
+    hash = "sha256-e9N869W8STZdLUBSscxEnF2Z+SrdVv8ARDL8AMe1SJ8=";
+  };
+
+  nativeBuildInputs = [
+    autoreconfHook
+    SDL.dev
+  ];
+
+  buildInputs = [
+    SDL
+    SDL_mixer
+  ];
+
+  strictDeps = true;
+  enableParallelBuilding = true;
+
+  configureFlags = [ "--with-audio=sdlmixer" ];
+
+  installPhase = ''
+    runHook preInstall
+
+    install -Dm755 hheretic-gl -t $out/bin
+
+    runHook postInstall
+  '';
+
+  passthru.updateScript = gitUpdater {
+    rev-prefix = "hheretic-";
+  };
+
+  meta = {
+    description = "Linux port of Raven Game's Heretic";
+    homepage = "https://hhexen.sourceforge.net/hhexen.html";
+    license = lib.licenses.gpl2Plus;
+    mainProgram = "hheretic-gl";
+    maintainers = with lib.maintainers; [ moody ];
+    inherit (SDL.meta) platforms;
+  };
+})
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 5eaaa1e01a72..5785981cb561 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -38226,6 +38226,8 @@ with pkgs;
 
   hhexen = callPackage ../games/hhexen { };
 
+  hheretic = callPackage ../games/hheretic { };
+
   wyvern = callPackage ../games/wyvern { };
 
   hsetroot = callPackage ../tools/X11/hsetroot { };