nethack: fix the last-minute fix

This commit is contained in:
Nikolay Amiantov 2015-12-08 18:10:53 +03:00
parent 459a5c5803
commit b6c9ce9b03

View File

@ -8,7 +8,7 @@ let
if stdenv.isLinux then "linux" if stdenv.isLinux then "linux"
# We probably want something different for Darwin # We probably want something different for Darwin
else "unix"; else "unix";
userDir = "~/.local/nethack"; userDir = "~/.config/nethack";
in stdenv.mkDerivation { in stdenv.mkDerivation {
name = "nethack-3.6.0"; name = "nethack-3.6.0";
@ -54,20 +54,21 @@ in stdenv.mkDerivation {
mkdir -p $out/bin mkdir -p $out/bin
cat <<EOF >$out/bin/nethack cat <<EOF >$out/bin/nethack
#! ${stdenv.shell} -e #! ${stdenv.shell} -e
if [ ! -d ${userDir} ]; then if [ ! -d ${userDir} ]; then
mkdir -p ${userDir} mkdir -p ${userDir}
cp -r $out/games/lib/nethackuserdir/* ${userDir} cp -r $out/games/lib/nethackuserdir/* ${userDir}
chmod -R +w ${userDir} chmod -R +w ${userDir}
fi fi
RUNDIR=$(mktemp -d nethack) RUNDIR=\$(mktemp -td nethack.\$USER.XXXXX)
cleanup() { cleanup() {
rm -rf $RUNDIR rm -rf \$RUNDIR
} }
trap cleanup EXIT trap cleanup EXIT
cd $RUNDIR cd \$RUNDIR
for i in ${userDir}/*; do for i in ${userDir}/*; do
ln -s \$i \$(basename \$i) ln -s \$i \$(basename \$i)
done done