about summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
authorAnderson Torres <torres.anderson.85@protonmail.com>2022-06-17 18:25:17 -0300
committerGitHub <noreply@github.com>2022-06-17 18:25:17 -0300
commit9877c297344ee8942b6eaf9b79741a5a931dcbc9 (patch)
treefce5d80a206070822f44a328c165097a67e7884a /pkgs/games
parentfe1afe8da8d80d6f34505ff02bfb628908bf1b54 (diff)
parent24b40a255c6adc6ab32c69737e8b4cfc50d8c8b4 (diff)
Merge pull request #169120 from aciceri/master
umoria: init at 5.7.15
Diffstat (limited to 'pkgs/games')
-rw-r--r--pkgs/games/umoria/default.nix80
1 files changed, 80 insertions, 0 deletions
diff --git a/pkgs/games/umoria/default.nix b/pkgs/games/umoria/default.nix
new file mode 100644
index 0000000000000..1114d47b7be56
--- /dev/null
+++ b/pkgs/games/umoria/default.nix
@@ -0,0 +1,80 @@
+{ lib
+, gcc9Stdenv
+, fetchFromGitHub
+, autoreconfHook
+, cmake
+, ncurses6
+, runtimeShell
+}:
+
+let
+  savesDir = "~/.umoria/";
+in
+gcc9Stdenv.mkDerivation rec {
+  pname = "umoria";
+  version = "5.7.15";
+
+  src = fetchFromGitHub {
+    owner = "dungeons-of-moria";
+    repo = "umoria";
+    rev = "v${version}";
+    sha256 = "sha256-1j4QkE33UcTzM06qAjk1/PyK5uNA7E/kyDe3bZcFKUM=";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ ncurses6 ];
+  enableParallelBuilding = true;
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out/data $out/bin
+    cp -r umoria/data/* $out/data
+    cp umoria/umoria $out/.umoria-unwrapped
+
+    mkdir -p $out/bin
+    cat <<EOF >$out/bin/umoria
+    #! ${runtimeShell} -e
+
+    RUNDIR=\$(mktemp -d)
+
+    cleanup() {
+      rm -rf \$RUNDIR
+    }
+
+    trap cleanup EXIT
+
+    cd \$RUNDIR
+    mkdir data
+
+    for i in $out/data/*; do
+      ln -s \$i "data/\$(basename \$i)"
+    done
+
+    mkdir -p ${savesDir}
+    [[ ! -f ${savesDir}/scores.dat ]] && touch ${savesDir}/scores.dat
+    ln -s ${savesDir}/scores.dat scores.dat
+
+    $out/.umoria-unwrapped
+    EOF
+
+    chmod +x $out/bin/umoria
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    homepage = "https://umoria.org/";
+    description = "The Dungeons of Moria - the original roguelike";
+    longDescription = ''
+      The Dungeons of Moria is a single player dungeon simulation originally written
+      by Robert Alan Koeneke, with its first public release in 1983.
+      The game was originally developed using VMS Pascal before being ported to the C
+      language by James E. Wilson in 1988, and released a Umoria.
+    '';
+    platforms = platforms.unix;
+    badPlatforms = [ "aarch64-darwin" ];
+    maintainers = [ maintainers.aciceri ];
+    license = licenses.gpl3Plus;
+  };
+}