1 { pkgs, lib, stdenv, fetchzip, ncurses, libX11, libXaw, libXt, libXext, libXmu
2 , makeWrapper, writeScript }:
5 setup = writeScript "setup" ''
6 mkdir -p "$ANGBAND_PATH"
7 # Copy all the data files into place
8 cp -ar $1/* "$ANGBAND_PATH"
9 # The copied files are not writable, make them so
10 chmod +w -R "$ANGBAND_PATH"
13 stdenv.mkDerivation rec {
18 url = "https://www.amirrorclear.net/flowers/game/sil/Sil-130-src.zip";
19 sha256 = "1amp2mr3fxascra0k76sdsvikjh8g76nqh46kka9379zd35lfq8w";
23 nativeBuildInputs = [ makeWrapper ];
24 buildInputs = [ ncurses libX11 libXaw libXt libXext libXmu ];
26 sourceRoot = "source/Sil/src";
28 makefile = "Makefile.std";
31 # Allow usage of ANGBAND_PATH
32 substituteInPlace config.h --replace "#define FIXED_PATHS" ""
36 buildFlagsArray+=("LIBS=-lXaw -lXext -lSM -lICE -lXmu -lXt -lX11 -lncurses")
39 # Workaround build failure on -fno-common toolchains like upstream
40 # gcc-10. Otherwise build fails as:
41 # ld: main.o:/build/source/Sil/src/externs.h:57: multiple definition of
42 # `mini_screenshot_char'; variable.o:/build/source/Sil/src/externs.h:57: first defined here
43 NIX_CFLAGS_COMPILE = "-fcommon";
48 # the makefile doesn't have a sensible install target, so we have to do it ourselves
52 # Wrap the program to set a user-local ANGBAND_PATH, and run the setup script to copy files into place.
53 # We could just use the options for a user-local save and scores dir, but it tried to write to the
54 # lib directory anyway, so we might as well give everyone a copy
55 wrapProgram $out/bin/sil \
56 --run "export ANGBAND_PATH=\$HOME/.sil" \
57 --run "${setup} ${src}/Sil/lib"
63 saveDirCreation = pkgs.runCommand "save-dir-creation" {} ''
64 HOME=$(pwd) ${lib.getExe pkgs.sil} --help
65 test -d .sil && touch $out
70 description = "A rogue-like game set in the First Age of Middle-earth";
72 A game of adventure set in the First Age of Middle-earth, when the world still
73 rang with Elven song and gleamed with Dwarven mail.
75 Walk the dark halls of Angband. Slay creatures black and fell. Wrest a shining
76 Silmaril from Morgoth’s iron crown.
78 homepage = "http://www.amirrorclear.net/flowers/game/sil/index.html";
79 license = lib.licenses.gpl2;
80 maintainers = with lib.maintainers; [ michaelpj kenran ];
81 platforms = lib.platforms.linux;