2016-06-03 22:40:25 +02:00
|
|
|
{ stdenv, lib, file, fetchurl, unzip }:
|
2015-12-15 10:19:29 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "terraria-server";
|
2018-04-06 09:39:51 +02:00
|
|
|
version = "1.3.5.3";
|
2016-06-03 22:40:25 +02:00
|
|
|
urlVersion = lib.replaceChars ["."] [""] version;
|
2015-12-15 10:19:29 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-06-28 20:43:35 +02:00
|
|
|
url = "https://terraria.org/server/terraria-server-${urlVersion}.zip";
|
2018-04-06 09:39:51 +02:00
|
|
|
sha256 = "0l7j2n6ip4hxph7dfal7kzdm3dqnm1wba6zc94gafkh97wr35ck3";
|
2015-12-15 10:19:29 +01:00
|
|
|
};
|
|
|
|
|
2016-06-03 22:40:25 +02:00
|
|
|
buildInputs = [ file unzip ];
|
2015-12-15 10:19:29 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
2016-06-03 22:40:25 +02:00
|
|
|
cp -r Linux $out/
|
2016-08-07 03:58:38 +02:00
|
|
|
chmod +x "$out/Linux/TerrariaServer.bin.x86_64"
|
2016-06-03 22:40:25 +02:00
|
|
|
ln -s "$out/Linux/TerrariaServer.bin.x86_64" $out/bin/TerrariaServer
|
2015-12-15 10:19:29 +01: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 22:40:25 +02:00
|
|
|
description = "Dedicated server for Terraria, a 2D action-adventure sandbox";
|
2018-05-03 07:58:11 +02:00
|
|
|
platforms = ["x86_64-linux"];
|
2015-12-15 10:19:29 +01:00
|
|
|
license = licenses.unfree;
|
|
|
|
};
|
|
|
|
}
|