Merge pull request #15403 from Shados/maintain-teamspeak-server

teamspeak-server package & module maintenance
This commit is contained in:
Joachim Fasting 2016-05-12 13:01:38 +02:00
commit 639dcffa0b
2 changed files with 39 additions and 36 deletions

View file

@ -10,13 +10,12 @@ let
in
{
###### interface
options = {
services.teamspeak3 = {
enable = mkOption {
type = types.bool;
default = false;
@ -96,34 +95,32 @@ in
###### implementation
config = mkIf cfg.enable {
users.extraUsers.teamspeak =
{ name = "teamspeak";
config = mkMerge [
(mkIf cfg.enable {
users.users.teamspeak = {
description = "Teamspeak3 voice communication server daemon";
group = group;
uid = config.ids.uids.teamspeak;
home = cfg.dataDir;
createHome = true;
};
users.extraGroups.teamspeak =
{ name = "teamspeak";
users.groups.teamspeak = {
gid = config.ids.gids.teamspeak;
};
systemd.services.teamspeak3-server = {
description = "Teamspeak3 voice communication server daemon";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
systemd.services.teamspeak3-server = {
description = "Teamspeak3 voice communication server daemon";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
preStart = ''
mkdir -p ${cfg.dataDir}
mkdir -p ${cfg.logPath}
chown ${user}:${group} ${cfg.dataDir}
chown ${user}:${group} ${cfg.logPath}
'';
preStart = ''
mkdir -p ${cfg.logPath}
chown ${user}:${group} ${cfg.logPath}
'';
serviceConfig =
{ ExecStart = ''
serviceConfig = {
ExecStart = ''
${ts3}/bin/ts3server \
dbsqlpath=${ts3}/lib/teamspeak/sql/ logpath=${cfg.logPath} \
voice_ip=${cfg.voiceIP} default_voice_port=${toString cfg.defaultVoicePort} \
@ -133,10 +130,12 @@ in
WorkingDirectory = cfg.dataDir;
User = user;
Group = group;
PermissionsStartOnly = true; # preStart needs to run with root permissions
PermissionsStartOnly = true;
};
};
};
})
{
meta.maintainers = with lib.maintainers; [ arobyn ];
}
];
}

View file

@ -1,11 +1,8 @@
{ stdenv, fetchurl, makeWrapper }:
let
version = "3.0.10.3";
version = "3.0.12.4";
arch = if stdenv.is64bit then "amd64" else "x86";
libDir = if stdenv.is64bit then "lib64" else "lib";
in
@ -14,25 +11,30 @@ stdenv.mkDerivation {
src = fetchurl {
urls = [
"http://dl.4players.de/ts/releases/${version}/teamspeak3-server_linux-${arch}-${version}.tar.gz"
"http://teamspeak.gameserver.gamed.de/ts3/releases/${version}/teamspeak3-server_linux-${arch}-${version}.tar.gz"
"http://dl.4players.de/ts/releases/${version}/teamspeak3-server_linux_${arch}-${version}.tar.bz2"
"http://teamspeak.gameserver.gamed.de/ts3/releases/${version}/teamspeak3-server_linux_${arch}-${version}.tar.bz2"
];
sha256 = if stdenv.is64bit
then "9606dd5c0c3677881b1aab833cb99f4f12ba08cc77ef4a97e9e282d9e10b0702"
else "8b8921e0df04bf74068a51ae06d744f25d759a8c267864ceaf7633eb3f81dbe5";
then "1n8vgbgnfbllfvsl82ai6smv6hl32a3nd071j2dp79agjz4fic3b"
else "19vkcgb0h71amixry8r72qqwaxwplzyz9nrxg5bdjjg8r2mkh4bc";
};
buildInputs = [ makeWrapper ];
buildPhase =
''
mv ts3server_linux_${arch} ts3server
echo "patching ts3server"
patchelf \
--interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath $(cat $NIX_CC/nix-support/orig-cc)/${libDir} \
--force-rpath \
ts3server
cp tsdns/tsdnsserver tsdnsserver
patchelf \
--interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath $(cat $NIX_CC/nix-support/orig-cc)/${libDir} \
--force-rpath \
tsdnsserver
'';
installPhase =
@ -44,17 +46,19 @@ stdenv.mkDerivation {
mkdir -p $out/lib/teamspeak
mv * $out/lib/teamspeak/
# Make a symlink to the binary from bin.
# Make symlinks to the binaries from bin.
mkdir -p $out/bin/
ln -s $out/lib/teamspeak/ts3server $out/bin/ts3server
ln -s $out/lib/teamspeak/tsdnsserver $out/bin/tsdnsserver
wrapProgram $out/lib/teamspeak/ts3server --prefix LD_LIBRARY_PATH : $out/lib/teamspeak
wrapProgram $out/lib/teamspeak/tsdnsserver --prefix LD_LIBRARY_PATH : $out/lib/tsdnsserver
'';
dontStrip = true;
dontPatchELF = true;
meta = {
meta = {
description = "TeamSpeak voice communication server";
homepage = http://teamspeak.com/;
license = stdenv.lib.licenses.unfreeRedistributable;