2022-06-15 21:22:33 +00:00
|
|
|
|
{ pkgs, lib, stdenv, fetchFromGitHub, writeScript, makeWrapper, ncurses, libX11 }:
|
2022-06-11 20:29:35 +00:00
|
|
|
|
|
|
|
|
|
let
|
|
|
|
|
setup = writeScript "setup" ''
|
|
|
|
|
mkdir -p "$ANGBAND_PATH"
|
|
|
|
|
# copy all the data files into place
|
|
|
|
|
cp -ar $1/* "$ANGBAND_PATH"
|
|
|
|
|
# the copied files need to be writable
|
|
|
|
|
chmod +w -R "$ANGBAND_PATH"
|
|
|
|
|
'';
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
|
pname = "sil-q";
|
|
|
|
|
version = "1.5.0";
|
|
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
|
owner = "sil-quirk";
|
|
|
|
|
repo = "sil-q";
|
|
|
|
|
rev = "v${version}";
|
|
|
|
|
sha256 = "sha256-v/sWhPWF9cCKD8N0RHpwzChMM1t9G2yrMDmi1cZxdOs=";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
buildInputs = [ ncurses libX11 ];
|
|
|
|
|
|
|
|
|
|
# Makefile(s) and config are not top-level
|
2023-07-25 13:27:31 +00:00
|
|
|
|
sourceRoot = "${src.name}/src";
|
2022-06-11 20:29:35 +00:00
|
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
|
# allow usage of ANGBAND_PATH
|
|
|
|
|
substituteInPlace config.h --replace "#define FIXED_PATHS" ""
|
|
|
|
|
|
|
|
|
|
# change Makefile.std for ncurses according to its own comment
|
|
|
|
|
substituteInPlace Makefile.std --replace "-lcurses" "-lncurses"
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
makefile = "Makefile.std";
|
|
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
|
|
mkdir -p $out/bin
|
|
|
|
|
cp sil $out/bin/sil-q
|
|
|
|
|
wrapProgram $out/bin/sil-q \
|
2022-10-03 10:14:47 +00:00
|
|
|
|
--run "export ANGBAND_PATH=\$HOME/.sil-q" \
|
2022-06-11 20:29:35 +00:00
|
|
|
|
--run "${setup} ${src}/lib"
|
|
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
|
'';
|
|
|
|
|
|
2022-06-15 21:22:33 +00:00
|
|
|
|
passthru.tests = {
|
|
|
|
|
saveDirCreation = pkgs.runCommand "save-dir-creation" {} ''
|
|
|
|
|
HOME=$(pwd) ${lib.getExe pkgs.sil-q} --help
|
2022-10-03 10:14:47 +00:00
|
|
|
|
test -d .sil-q && touch $out
|
2022-06-15 21:22:33 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2022-06-11 20:29:35 +00:00
|
|
|
|
meta = {
|
|
|
|
|
description = "Roguelike game set in the First Age of Middle-earth";
|
2024-03-19 02:14:51 +00:00
|
|
|
|
mainProgram = "sil-q";
|
2022-06-11 20:29:35 +00:00
|
|
|
|
longDescription = ''
|
|
|
|
|
A game of adventure set in the First Age of Middle-earth, when the world still
|
|
|
|
|
rang with Elven song and gleamed with Dwarven mail.
|
|
|
|
|
|
|
|
|
|
Walk the dark halls of Angband. Slay creatures black and fell. Wrest a shining
|
|
|
|
|
Silmaril from Morgoth’s iron crown.
|
|
|
|
|
|
|
|
|
|
A fork of Sil that's still actively developed.
|
|
|
|
|
'';
|
|
|
|
|
homepage = "https://github.com/sil-quirk/sil-q";
|
2024-07-03 09:37:36 +00:00
|
|
|
|
license = lib.licenses.gpl2Only;
|
2022-06-11 20:29:35 +00:00
|
|
|
|
maintainers = [ lib.maintainers.kenran ];
|
|
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
|
};
|
|
|
|
|
}
|