summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Peyton Jones <me@michaelpj.com>2018-02-04 22:51:03 +0000
committerMichael Peyton Jones <me@michaelpj.com>2018-02-27 22:35:07 +0000
commitcd867e9acabb98aa0b7bdeacc368fad0a3b7efbe (patch)
treed67b160cc428c1221d2332d2187788bd6199b322
parent2e4aded366914d625a2f31208e8ac8548cb43a7e (diff)
downloadnixpkgs-cd867e9acabb98aa0b7bdeacc368fad0a3b7efbe.tar
nixpkgs-cd867e9acabb98aa0b7bdeacc368fad0a3b7efbe.tar.gz
nixpkgs-cd867e9acabb98aa0b7bdeacc368fad0a3b7efbe.tar.bz2
nixpkgs-cd867e9acabb98aa0b7bdeacc368fad0a3b7efbe.tar.lz
nixpkgs-cd867e9acabb98aa0b7bdeacc368fad0a3b7efbe.tar.xz
nixpkgs-cd867e9acabb98aa0b7bdeacc368fad0a3b7efbe.tar.zst
nixpkgs-cd867e9acabb98aa0b7bdeacc368fad0a3b7efbe.zip
sil: init at 1.3.0
-rw-r--r--pkgs/games/sil/default.nix63
-rw-r--r--pkgs/top-level/all-packages.nix2
2 files changed, 65 insertions, 0 deletions
diff --git a/pkgs/games/sil/default.nix b/pkgs/games/sil/default.nix
new file mode 100644
index 00000000000..de91f26d95d
--- /dev/null
+++ b/pkgs/games/sil/default.nix
@@ -0,0 +1,63 @@
+{ stdenv, fetchzip, ncurses, libX11, libXaw, libXt, libXext, libXmu, makeWrapper, writeScript, ... }:
+let 
+  setup = writeScript "setup" ''
+    mkdir -p "$ANGBAND_PATH"
+    # Copy all the data files into place
+    cp -ar $1/* "$ANGBAND_PATH"
+    # The copied files are not writable, make them so
+    chmod +w -R "$ANGBAND_PATH"
+  '';
+in
+stdenv.mkDerivation rec {
+  name = "Sil-${version}";
+  version = "1.3.0";
+
+  src = fetchzip {
+    url = "http://www.amirrorclear.net/flowers/game/sil/Sil-130-src.zip";
+    sha256 = "1amp2mr3fxascra0k76sdsvikjh8g76nqh46kka9379zd35lfq8w";
+    stripRoot=false;
+  };
+
+  buildInputs = [ makeWrapper ncurses libX11 libXaw libXt libXext libXmu ];
+
+  sourceRoot = "source/Sil/src";
+
+  makefile = "Makefile.std";
+
+  prePatch = ''
+    # Allow usage of ANGBAND_PATH
+    substituteInPlace config.h --replace "#define FIXED_PATHS" "" 
+  '';
+
+  preConfigure = ''
+    buildFlagsArray+=("LIBS=-lXaw -lXext -lSM -lICE -lXmu -lXt -lX11 -lncurses")
+  '';
+
+  installPhase = ''
+    # the makefile doesn't have a sensible install target, so we hav to do it ourselves
+    mkdir -p $out/bin
+    cp sil $out/bin/sil
+    # Wrap the program to set a user-local ANGBAND_PATH, and run the setup script to copy files into place
+    # We could just use the options for a user-local save and scores dir, but it tried to write to the 
+    # lib directory anyway, so we might as well give everyone a copy
+    wrapProgram $out/bin/sil \
+      --run "set -u" \
+      --run "export ANGBAND_PATH=\$HOME/.sil" \
+      --run "${setup} ${src}/Sil/lib"
+  '';
+
+  meta = {
+    description = "A rouge-like game set in the first age of Middle-earth";
+    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.
+    '';
+    homepage = http://www.amirrorclear.net/flowers/game/sil/index.html;
+    license = stdenv.lib.licenses.gpl2;
+    maintainers = [ stdenv.lib.maintainers.michaelpj ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index d89ab305966..4ef3a69d98d 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -18621,6 +18621,8 @@ with pkgs;
 
   sienna = callPackage ../games/sienna { love = love_0_10; };
 
+  sil = callPackage ../games/sil { };
+
   simutrans = callPackage ../games/simutrans { };
   # get binaries without data built by Hydra
   simutrans_binaries = lowPrio simutrans.binaries;