summary refs log tree commit diff
path: root/pkgs/games/nethack
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2015-12-08 18:10:53 +0300
committerNikolay Amiantov <ab@fmap.me>2015-12-08 18:10:53 +0300
commitb6c9ce9b038bf5af6e6a6bed791efbb32d2edb3f (patch)
treeb163f306ea4e63b93390e82c8797a76fc54bc399 /pkgs/games/nethack
parent459a5c5803206070a7256644da25526043c01327 (diff)
downloadnixpkgs-b6c9ce9b038bf5af6e6a6bed791efbb32d2edb3f.tar
nixpkgs-b6c9ce9b038bf5af6e6a6bed791efbb32d2edb3f.tar.gz
nixpkgs-b6c9ce9b038bf5af6e6a6bed791efbb32d2edb3f.tar.bz2
nixpkgs-b6c9ce9b038bf5af6e6a6bed791efbb32d2edb3f.tar.lz
nixpkgs-b6c9ce9b038bf5af6e6a6bed791efbb32d2edb3f.tar.xz
nixpkgs-b6c9ce9b038bf5af6e6a6bed791efbb32d2edb3f.tar.zst
nixpkgs-b6c9ce9b038bf5af6e6a6bed791efbb32d2edb3f.zip
nethack: fix the last-minute fix
Diffstat (limited to 'pkgs/games/nethack')
-rw-r--r--pkgs/games/nethack/default.nix41
1 files changed, 21 insertions, 20 deletions
diff --git a/pkgs/games/nethack/default.nix b/pkgs/games/nethack/default.nix
index d3a510e2952..05c39fb2f2b 100644
--- a/pkgs/games/nethack/default.nix
+++ b/pkgs/games/nethack/default.nix
@@ -8,7 +8,7 @@ let
     if stdenv.isLinux then "linux"
     # We probably want something different for Darwin
     else "unix";
-  userDir = "~/.local/nethack";
+  userDir = "~/.config/nethack";
 
 in stdenv.mkDerivation {
   name = "nethack-3.6.0";
@@ -53,28 +53,29 @@ in stdenv.mkDerivation {
 
     mkdir -p $out/bin
     cat <<EOF >$out/bin/nethack
-      #! ${stdenv.shell} -e
-      if [ ! -d ${userDir} ]; then
-        mkdir -p ${userDir}
-        cp -r $out/games/lib/nethackuserdir/* ${userDir}
-        chmod -R +w ${userDir}
-      fi
+    #! ${stdenv.shell} -e
 
-      RUNDIR=$(mktemp -d nethack)
+    if [ ! -d ${userDir} ]; then
+      mkdir -p ${userDir}
+      cp -r $out/games/lib/nethackuserdir/* ${userDir}
+      chmod -R +w ${userDir}
+    fi
 
-      cleanup() {
-        rm -rf $RUNDIR
-      }
-      trap cleanup EXIT
+    RUNDIR=\$(mktemp -td nethack.\$USER.XXXXX)
 
-      cd $RUNDIR
-      for i in ${userDir}/*; do
-        ln -s \$i \$(basename \$i)
-      done
-      for i in $out/games/lib/nethackdir/*; do
-        ln -s \$i \$(basename \$i)
-      done
-      $out/games/nethack
+    cleanup() {
+      rm -rf \$RUNDIR
+    }
+    trap cleanup EXIT
+
+    cd \$RUNDIR
+    for i in ${userDir}/*; do
+      ln -s \$i \$(basename \$i)
+    done
+    for i in $out/games/lib/nethackdir/*; do
+      ln -s \$i \$(basename \$i)
+    done
+    $out/games/nethack
     EOF
     chmod +x $out/bin/nethack
   '';