2016-06-03 20:40:25 +00:00
|
|
|
{ stdenv, lib, file, fetchurl, unzip }:
|
2015-12-15 09:19:29 +00:00
|
|
|
assert stdenv.system == "x86_64-linux";
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "terraria-server-${version}";
|
2016-06-03 20:40:25 +00:00
|
|
|
version = "1.3.1.1";
|
|
|
|
urlVersion = lib.replaceChars ["."] [""] version;
|
2015-12-15 09:19:29 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2016-06-03 20:40:25 +00:00
|
|
|
url = "http://terraria.org/server/terraria-server-${urlVersion}.zip";
|
|
|
|
sha256 = "0bwh0na0dy6cjc1xchd5sp3c7av50q38hk03219dmqd72n9p44rq";
|
2015-12-15 09:19:29 +00:00
|
|
|
};
|
|
|
|
|
2016-06-03 20:40:25 +00:00
|
|
|
buildInputs = [ file unzip ];
|
2015-12-15 09:19:29 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
2016-06-03 20:40:25 +00:00
|
|
|
cp -r Linux $out/
|
|
|
|
ln -s "$out/Linux/TerrariaServer.bin.x86_64" $out/bin/TerrariaServer
|
2015-12-15 09:19:29 +00:00
|
|
|
# Fix "/lib64/ld-linux-x86-64.so.2" like references in ELF executables.
|
|
|
|
find "$out" | while read filepath; do
|
|
|
|
if file "$filepath" | grep -q "ELF.*executable"; then
|
|
|
|
echo "setting interpreter $(cat "$NIX_CC"/nix-support/dynamic-linker) in $filepath"
|
|
|
|
patchelf --set-interpreter "$(cat "$NIX_CC"/nix-support/dynamic-linker)" "$filepath"
|
|
|
|
test $? -eq 0 || { echo "patchelf failed to process $filepath"; exit 1; }
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = http://terraria.org;
|
2016-06-03 20:40:25 +00:00
|
|
|
description = "Dedicated server for Terraria, a 2D action-adventure sandbox";
|
2015-12-15 09:19:29 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.unfree;
|
|
|
|
};
|
|
|
|
}
|