ansible-later: 2.0.22 -> 2.0.23
[NixPkgs.git] / pkgs / games / unnethack / default.nix
blob03928ff48f4c0c5a66b34143f3854324d5b0ea1f
1 { lib, stdenv, fetchFromGitHub, fetchpatch, util-linux, ncurses, flex, bison }:
3 stdenv.mkDerivation rec {
4   pname = "unnethack";
5   version = "5.3.2";
7   src = fetchFromGitHub {
8     name = "UnNetHack";
9     owner = "UnNetHack";
10     repo = "UnNetHack";
11     rev = version;
12     sha256 = "1rg0mqyplgn3dfh3wz09a600qxk7aidqw4d84kyiincljvhyb7ps";
13   };
15   buildInputs = [ ncurses ];
17   nativeBuildInputs = [ util-linux flex bison ];
19   configureFlags = [ "--enable-curses-graphics"
20                      "--disable-tty-graphics"
21                      "--with-owner=no"
22                      "--with-group=no"
23                      "--with-gamesdir=/tmp/unnethack"
24                    ];
26   makeFlags = [ "GAMEPERM=744" ];
27   patches = [
28     # fix regression with bison, merged in master
29     (fetchpatch {
30       name = "fix-bison.patch";
31       url = "https://github.com/UnNetHack/UnNetHack/commit/04f0a3a850a94eb8837ddcef31303968240d1c31.patch";
32       sha256 = "1zblbwqqz9nx16k6n31wi2hdvz775lvzmkjblmrx18nbm4ylj0n9";
33     })
34   ];
36   enableParallelBuilding = true;
38   postInstall = ''
39     cp -r /tmp/unnethack $out/share/unnethack/profile
40     mv $out/bin/unnethack $out/bin/.wrapped_unnethack
41     cat <<EOF >$out/bin/unnethack
42       #! ${stdenv.shell} -e
43       if [ ! -d ~/.unnethack ]; then
44         mkdir -p ~/.unnethack
45         cp -r $out/share/unnethack/profile/* ~/.unnethack
46         chmod -R +w ~/.unnethack
47       fi
49       ln -s ~/.unnethack /tmp/unnethack
51       cleanup() {
52         rm -rf /tmp/unnethack
53       }
54       trap cleanup EXIT
56       $out/bin/.wrapped_unnethack
57     EOF
58     chmod +x $out/bin/unnethack
59   '';
61   meta = with lib; {
62     description = "Fork of NetHack";
63     homepage = "https://unnethack.wordpress.com/";
64     license = "nethack";
65     platforms = platforms.all;
66     maintainers = with maintainers; [ abbradar ];
67   };