1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-22 13:41:26 +00:00
nixpkgs/pkgs/games/unnethack/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

69 lines
1.8 KiB
Nix

{ lib, stdenv, fetchFromGitHub, fetchpatch, util-linux, ncurses, flex, bison }:
stdenv.mkDerivation rec {
pname = "unnethack";
version = "5.3.2";
src = fetchFromGitHub {
name = "UnNetHack";
owner = "UnNetHack";
repo = "UnNetHack";
rev = version;
sha256 = "1rg0mqyplgn3dfh3wz09a600qxk7aidqw4d84kyiincljvhyb7ps";
};
buildInputs = [ ncurses ];
nativeBuildInputs = [ util-linux flex bison ];
configureFlags = [ "--enable-curses-graphics"
"--disable-tty-graphics"
"--with-owner=no"
"--with-group=no"
"--with-gamesdir=/tmp/unnethack"
];
makeFlags = [ "GAMEPERM=744" ];
patches = [
# fix regression with bison, merged in master
(fetchpatch {
name = "fix-bison.patch";
url = "https://github.com/UnNetHack/UnNetHack/commit/04f0a3a850a94eb8837ddcef31303968240d1c31.patch";
sha256 = "1zblbwqqz9nx16k6n31wi2hdvz775lvzmkjblmrx18nbm4ylj0n9";
})
];
enableParallelBuilding = true;
postInstall = ''
cp -r /tmp/unnethack $out/share/unnethack/profile
mv $out/bin/unnethack $out/bin/.wrapped_unnethack
cat <<EOF >$out/bin/unnethack
#! ${stdenv.shell} -e
if [ ! -d ~/.unnethack ]; then
mkdir -p ~/.unnethack
cp -r $out/share/unnethack/profile/* ~/.unnethack
chmod -R +w ~/.unnethack
fi
ln -s ~/.unnethack /tmp/unnethack
cleanup() {
rm -rf /tmp/unnethack
}
trap cleanup EXIT
$out/bin/.wrapped_unnethack
EOF
chmod +x $out/bin/unnethack
'';
meta = with lib; {
description = "Fork of NetHack";
homepage = "https://unnethack.wordpress.com/";
license = "nethack";
platforms = platforms.all;
maintainers = with maintainers; [ abbradar ];
};
}