summary refs log tree commit diff
path: root/pkgs/games/nethack
diff options
context:
space:
mode:
authornonfreeblob <nonfreeblob@yandex.com>2018-06-29 15:21:56 +0300
committernonfreeblob <nonfreeblob@yandex.com>2018-06-30 14:48:20 +0300
commit1627b6fc09ca9796451bde019fa0ee208ca478be (patch)
treecebe9349022a1bb4640cc41d33930625b6ee2258 /pkgs/games/nethack
parentb00d53fcfebaa06b864aa5f27ffe2864d8617635 (diff)
downloadnixpkgs-1627b6fc09ca9796451bde019fa0ee208ca478be.tar
nixpkgs-1627b6fc09ca9796451bde019fa0ee208ca478be.tar.gz
nixpkgs-1627b6fc09ca9796451bde019fa0ee208ca478be.tar.bz2
nixpkgs-1627b6fc09ca9796451bde019fa0ee208ca478be.tar.lz
nixpkgs-1627b6fc09ca9796451bde019fa0ee208ca478be.tar.xz
nixpkgs-1627b6fc09ca9796451bde019fa0ee208ca478be.tar.zst
nixpkgs-1627b6fc09ca9796451bde019fa0ee208ca478be.zip
nethack: nethack-x11 package created
If x11Mode is false, ncurses NetHack version will be built (nethack).
If x11Mode is true, x11 NetHack version will be built (nethack-x11).
NetHack DevTeam provide x11 version support only for Linux.
Diffstat (limited to 'pkgs/games/nethack')
-rw-r--r--pkgs/games/nethack/default.nix16
1 files changed, 10 insertions, 6 deletions
diff --git a/pkgs/games/nethack/default.nix b/pkgs/games/nethack/default.nix
index 1ad7565f450..eed38592236 100644
--- a/pkgs/games/nethack/default.nix
+++ b/pkgs/games/nethack/default.nix
@@ -1,11 +1,14 @@
-{ stdenv, lib, fetchurl, writeScript, coreutils, ncurses, gzip, flex, bison, less }:
+{ stdenv, lib, fetchurl, writeScript, coreutils, ncurses, gzip, flex, bison, less
+, x11Mode ? false, libXaw, libXext, mkfontdir
+}:
 
 let
   platform =
     if stdenv.hostPlatform.isUnix then "unix"
     else throw "Unknown platform for NetHack: ${stdenv.system}";
   unixHint =
-    /**/ if stdenv.hostPlatform.isLinux  then "linux"
+    if x11Mode then "linux-x11"
+    else if stdenv.hostPlatform.isLinux  then "linux"
     else if stdenv.hostPlatform.isDarwin then "macosx10.10"
     # We probably want something different for Darwin
     else "unix";
@@ -13,16 +16,16 @@ let
   binPath = lib.makeBinPath [ coreutils less ];
 
 in stdenv.mkDerivation {
-  name = "nethack-3.6.1";
+  name = "nethack${lib.optionalString x11Mode "-x11"}-3.6.1";
 
   src = fetchurl {
     url = "https://nethack.org/download/3.6.1/nethack-361-src.tgz";
     sha256 = "1dha0ijvxhx7c9hr0452h93x81iiqsll8bc9msdnp7xdqcfbz32b";
   };
 
-  buildInputs = [ ncurses ];
+  buildInputs = [ ncurses ] ++ lib.optionals x11Mode [ libXaw libXext ];
 
-  nativeBuildInputs = [ flex bison ];
+  nativeBuildInputs = [ flex bison ] ++ lib.optionals x11Mode [ mkfontdir ];
 
   makeFlags = [ "PREFIX=$(out)" ];
 
@@ -86,13 +89,14 @@ in stdenv.mkDerivation {
     $out/games/nethack
     EOF
     chmod +x $out/bin/nethack
+    ${lib.optionalString x11Mode "mv $out/bin/nethack $out/bin/nethack-x11"}
   '';
 
   meta = with stdenv.lib; {
     description = "Rogue-like game";
     homepage = http://nethack.org/;
     license = "nethack";
-    platforms = platforms.unix;
+    platforms = if x11Mode then platforms.linux else platforms.unix;
     maintainers = with maintainers; [ abbradar ];
   };
 }