From 7c84e3b785c2a512af1e2c185a5d830df56876b0 Mon Sep 17 00:00:00 2001 From: Andrew Morsillo Date: Wed, 23 Jul 2014 22:41:30 -0400 Subject: [PATCH 1/2] Add dwarf fortress 2014 (unstable) version --- pkgs/games/dwarf-fortress/df2014.nix | 82 ++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 10 ++++ 2 files changed, 92 insertions(+) create mode 100644 pkgs/games/dwarf-fortress/df2014.nix diff --git a/pkgs/games/dwarf-fortress/df2014.nix b/pkgs/games/dwarf-fortress/df2014.nix new file mode 100644 index 000000000000..aecdb0a44e13 --- /dev/null +++ b/pkgs/games/dwarf-fortress/df2014.nix @@ -0,0 +1,82 @@ +{ stdenv, fetchurl, SDL, SDL_image, SDL_ttf, gtk, glib, mesa, openal, glibc, libsndfile +, copyDataDirectory ? false }: + +assert stdenv.system == "i686-linux"; + +stdenv.mkDerivation rec { + name = "dwarf-fortress-0.40.04"; + + src = fetchurl { + url = "http://www.bay12games.com/dwarves/df_40_04_linux.tar.bz2"; + sha256 = "0kzkq42mpih5lsv8bv98j8ls26a8sbb1amp8bnf04k63ai99b9zx"; + }; + + phases = "unpackPhase patchPhase installPhase"; + + /* :TODO: Game options should be configurable by patching the default configuration files */ + + permission = ./df_permission; + + installPhase = '' + set -x + mkdir -p $out/bin + mkdir -p $out/share/df_linux + cp -r * $out/share/df_linux + cp $permission $out/share/df_linux/nix_permission + + patchelf --set-interpreter ${glibc}/lib/ld-linux.so.2 $out/share/df_linux/libs/Dwarf_Fortress + ln -s ${libsndfile}/lib/libsndfile.so $out/share/df_linux/libs/ + + cat > $out/bin/dwarf-fortress << EOF + #!${stdenv.shell} + export DF_DIR="\$HOME/.config/df_linux" + if [ -n "\$XDG_DATA_HOME" ] + then export DF_DIR="\$XDG_DATA_HOME/df_linux" + fi + + # Recreate a directory structure reflecting the original + # distribution in the user directory (for modding support) + ${if copyDataDirectory then '' + if [ ! -d "\$DF_DIR" ]; + then + mkdir -p \$DF_DIR + cp -r $out/share/df_linux/* \$DF_DIR/ + chmod -R u+rw \$DF_DIR/ + fi + '' else '' + # Link in the static stuff + mkdir -p \$DF_DIR + ln -sf $out/share/df_linux/libs \$DF_DIR/ + ln -sf $out/share/df_linux/raw \$DF_DIR/ + ln -sf $out/share/df_linux/df \$DF_DIR/ + + # Delete old data directory + rm -rf \$DF_DIR/data + + # Link in the static data directory + mkdir \$DF_DIR/data + for i in $out/share/df_linux/data/* + do + ln -s \$i \$DF_DIR/data/ + done + + # link in persistant data + mkdir -p \$DF_DIR/save + ln -s \$DF_DIR/save \$DF_DIR/data/ + ''} + + # now run Dwarf Fortress! + export LD_LIBRARY_PATH=\$DF_DIR/df_linux/libs/:${SDL}/lib:${SDL_image}/lib/:${SDL_ttf}/lib/:${gtk}/lib/:${glib}/lib/:${mesa}/lib/:${openal}/lib/ + \$DF_DIR/df "\$@" + EOF + + chmod +x $out/bin/dwarf-fortress + ''; + + meta = { + description = "control a dwarven outpost or an adventurer in a randomly generated, persistent world"; + homepage = http://www.bay12games.com/dwarves; + license = "unfree-redistributable"; + maintainers = [stdenv.lib.maintainers.roconnor]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3c255103bb01..5ae67cd1688a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10129,10 +10129,20 @@ let }; }; + dwarf_fortress_2014 = callPackage_i686 ../games/dwarf-fortress/df2014.nix { + SDL_image = pkgsi686Linux.SDL_image.override { + libpng = pkgsi686Linux.libpng12; + }; + }; + dwarf_fortress_modable = appendToName "moddable" (dwarf_fortress.override { copyDataDirectory = true; }); + dwarf_fortress_2014_modable = appendToName "moddable" (dwarf_fortress_2014.override { + copyDataDirectory = true; + }); + dwarf-therapist = callPackage ../games/dwarf-therapist { }; d1x_rebirth = callPackage ../games/d1x-rebirth { }; From 911eb8d934a31f60a6d58aca9fcf44719f92b30e Mon Sep 17 00:00:00 2001 From: Andrew Morsillo Date: Mon, 28 Jul 2014 09:01:45 -0400 Subject: [PATCH 2/2] bump version to 0.40.05 --- pkgs/games/dwarf-fortress/df2014.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/games/dwarf-fortress/df2014.nix b/pkgs/games/dwarf-fortress/df2014.nix index aecdb0a44e13..6a0d30ea89f4 100644 --- a/pkgs/games/dwarf-fortress/df2014.nix +++ b/pkgs/games/dwarf-fortress/df2014.nix @@ -4,11 +4,11 @@ assert stdenv.system == "i686-linux"; stdenv.mkDerivation rec { - name = "dwarf-fortress-0.40.04"; + name = "dwarf-fortress-0.40.05"; src = fetchurl { - url = "http://www.bay12games.com/dwarves/df_40_04_linux.tar.bz2"; - sha256 = "0kzkq42mpih5lsv8bv98j8ls26a8sbb1amp8bnf04k63ai99b9zx"; + url = "http://www.bay12games.com/dwarves/df_40_05_linux.tar.bz2"; + sha256 = "1b9nd33yz5a945v9jyqii1k4s71i701m2d0h7fw6f5g9p6nvx43s"; }; phases = "unpackPhase patchPhase installPhase";