|
| 1 | +{ lib, stdenv, fetchFromGitHub, writeScript, makeWrapper, ncurses, libX11 }: |
| 2 | + |
| 3 | +let |
| 4 | + setup = writeScript "setup" '' |
| 5 | + mkdir -p "$ANGBAND_PATH" |
| 6 | + # copy all the data files into place |
| 7 | + cp -ar $1/* "$ANGBAND_PATH" |
| 8 | + # the copied files need to be writable |
| 9 | + chmod +w -R "$ANGBAND_PATH" |
| 10 | + ''; |
| 11 | +in stdenv.mkDerivation rec { |
| 12 | + pname = "sil-q"; |
| 13 | + version = "1.5.0"; |
| 14 | + |
| 15 | + src = fetchFromGitHub { |
| 16 | + owner = "sil-quirk"; |
| 17 | + repo = "sil-q"; |
| 18 | + rev = "v${version}"; |
| 19 | + sha256 = "sha256-v/sWhPWF9cCKD8N0RHpwzChMM1t9G2yrMDmi1cZxdOs="; |
| 20 | + }; |
| 21 | + |
| 22 | + nativeBuildInputs = [ makeWrapper ]; |
| 23 | + buildInputs = [ ncurses libX11 ]; |
| 24 | + |
| 25 | + # Makefile(s) and config are not top-level |
| 26 | + sourceRoot = "source/src"; |
| 27 | + |
| 28 | + postPatch = '' |
| 29 | + # allow usage of ANGBAND_PATH |
| 30 | + substituteInPlace config.h --replace "#define FIXED_PATHS" "" |
| 31 | +
|
| 32 | + # change Makefile.std for ncurses according to its own comment |
| 33 | + substituteInPlace Makefile.std --replace "-lcurses" "-lncurses" |
| 34 | + ''; |
| 35 | + |
| 36 | + makefile = "Makefile.std"; |
| 37 | + |
| 38 | + installPhase = '' |
| 39 | + runHook preInstall |
| 40 | +
|
| 41 | + mkdir -p $out/bin |
| 42 | + cp sil $out/bin/sil-q |
| 43 | + wrapProgram $out/bin/sil-q \ |
| 44 | + --run "export ANGBAND_PATH=\$HOME/.sil" \ |
| 45 | + --run "${setup} ${src}/lib" |
| 46 | +
|
| 47 | + runHook postInstall |
| 48 | + ''; |
| 49 | + |
| 50 | + meta = { |
| 51 | + description = "A roguelike game set in the First Age of Middle-earth"; |
| 52 | + longDescription = '' |
| 53 | + A game of adventure set in the First Age of Middle-earth, when the world still |
| 54 | + rang with Elven song and gleamed with Dwarven mail. |
| 55 | +
|
| 56 | + Walk the dark halls of Angband. Slay creatures black and fell. Wrest a shining |
| 57 | + Silmaril from Morgoth’s iron crown. |
| 58 | +
|
| 59 | + A fork of Sil that's still actively developed. |
| 60 | + ''; |
| 61 | + homepage = "https://github.com/sil-quirk/sil-q"; |
| 62 | + license = lib.licenses.gpl2; |
| 63 | + maintainers = [ lib.maintainers.kenran ]; |
| 64 | + platforms = lib.platforms.linux; |
| 65 | + }; |
| 66 | +} |
0 commit comments