2022-04-17 23:06:44 +01:00
|
|
|
{ lib
|
|
|
|
, gcc9Stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, autoreconfHook
|
|
|
|
, cmake
|
|
|
|
, ncurses6
|
|
|
|
, runtimeShell
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2022-06-18 12:54:28 +01:00
|
|
|
savesDir = "~/.umoria";
|
2022-04-17 23:06:44 +01:00
|
|
|
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)
|
|
|
|
|
2022-06-18 13:18:00 +01:00
|
|
|
# Print the directory, so users have access to dumps, and let the system
|
|
|
|
# take care of cleaning up temp files.
|
|
|
|
echo "Running umoria in \$RUNDIR"
|
2022-04-17 23:06:44 +01:00
|
|
|
|
|
|
|
cd \$RUNDIR
|
2022-06-18 13:18:00 +01:00
|
|
|
ln -sn $out/data \$RUNDIR/data
|
2022-04-17 23:06:44 +01:00
|
|
|
|
|
|
|
mkdir -p ${savesDir}
|
|
|
|
[[ ! -f ${savesDir}/scores.dat ]] && touch ${savesDir}/scores.dat
|
|
|
|
ln -s ${savesDir}/scores.dat scores.dat
|
|
|
|
|
2022-06-18 13:18:00 +01:00
|
|
|
if [ \$# -eq 0 ]; then
|
|
|
|
$out/.umoria-unwrapped ${savesDir}/game.sav
|
|
|
|
else
|
|
|
|
$out/.umoria-unwrapped "\$@"
|
|
|
|
fi
|
2022-04-17 23:06:44 +01:00
|
|
|
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" ];
|
2022-06-18 13:18:00 +01:00
|
|
|
maintainers = with maintainers; [ aciceri kenran ];
|
2022-04-17 23:06:44 +01:00
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
};
|
|
|
|
}
|