Skip to content

Commit

Permalink
Hacking on getting this thing to build for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
347Online committed Jan 29, 2025
1 parent 813e453 commit 4dec315
Showing 1 changed file with 109 additions and 63 deletions.
172 changes: 109 additions & 63 deletions pkgs/by-name/te/teamtalk5/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,83 +3,129 @@
lib,
fetchurl,
makeWrapper,
autoPatchelfHook,
xar,
cpio,
alsa-lib,
openssl,
pulseaudio,
libsForQt5,
qt5,
xorg,
}:
let
inherit (stdenv.hostPlatform) system;
throwSystem = throw "Unsupported system: ${stdenv.system}";
in
stdenv.mkDerivation (finalAttrs: {
pname = "teamtalk5";
version = "v5.17";
stdenv.mkDerivation (
finalAttrs:
let
version = finalAttrs.version;
in
{
pname = "teamtalk-client";
version = "v5.17";

src =
let
version = finalAttrs.version;
in
rec {
aarch64-darwin = fetchurl {
url = "https://bearware.dk/teamtalk/${version}/TeamTalk_${version}_Setup.pkg";
name = "TeamTalk_${version}_Setup.pkg";
hash = "sha256-oSl9cw0/rnOiqjZy3UBLOB3++CZUoe/LeMFM/jfgyZM=";
};
# App is universal
x86_64-darwin = aarch64-darwin;
}
.${stdenv.system} or throwSystem;

dontUnpack = stdenv.hostPlatform.isLinux;
unpackPhase = lib.optionalString stdenv.hostPlatform.isDarwin ''
xar -xf $src
zcat < dk.bearware.TeamTalk5.pkg/Payload | cpio -i
'';

installPhase = ''
runHook preInstall
${
src =
rec {
aarch64-darwin = ''
mkdir -p $out/Applications
cp -R TeamTalk5.app $out/Applications/
'';
# darwin steps same on both architectures
aarch64-darwin = fetchurl {
url = "https://bearware.dk/teamtalk/${version}/TeamTalk_${version}_Setup.pkg";
hash = "sha256-oSl9cw0/rnOiqjZy3UBLOB3++CZUoe/LeMFM/jfgyZM=";
};
# App is universal
x86_64-darwin = aarch64-darwin;
x86_64-linux = fetchurl {
url = "https://bearware.dk/teamtalk/${version}/teamtalk-${version}-ubuntu22-x86_64.tgz";
hash = "sha256-+M42U4cTm3fOysbqN+ff3//IatFGxM1AaxzzEEAzPqI=";
};
}
.${system} or throwSystem
}
runHook postInstall
'';
.${stdenv.system} or throwSystem;

postFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
makeWrapper $out/Applications/TeamTalk5.app/Contents/MacOS/TeamTalk5 $out/bin/teamtalk
'';
dontUnpack = stdenv.hostPlatform.isLinux;
unpackPhase = lib.optionalString stdenv.hostPlatform.isDarwin ''
xar -xf $src
zcat < dk.bearware.TeamTalk5.pkg/Payload | cpio -i
'';

nativeBuildInputs =
[
makeWrapper
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
xar
cpio
];
installPhase = ''
runHook preInstall
${
rec {
aarch64-darwin = ''
mkdir -p $out/Applications
cp -R TeamTalk5.app $out/Applications/
'';
# darwin steps same on both architectures
x86_64-darwin = aarch64-darwin;
x86_64-linux = ''
mkdir $out
tar -C $out -xf $src
mv $out/teamtalk-${version}-ubuntu22-x86_64/client $out/
mv $out/teamtalk-${version}-ubuntu22-x86_64/License.txt $out/
rm -rf $out/teamtalk-${version}-ubuntu22-x86_64
'';
}
.${system} or throwSystem
}
runHook postInstall
'';

# passthru.updateScript = lib.getExe (writeShellApplication {
# name = "teamtalk5-update-script"
# text = throw "TODO";
# });
postFixup =
lib.optionalString stdenv.hostPlatform.isDarwin ''
makeWrapper $out/Applications/TeamTalk5.app/Contents/MacOS/TeamTalk5 $out/bin/teamtalk
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
makeWrapper $out/client/teamtalk5 $out/bin/teamtalk
'';

meta = {
description = "TeamTalk 5 is a freeware conferencing system which allows multiple users to participate in audio and video conversations.";
homepage = "https://bearware.dk";
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [
_347online
# QT_DEBUG_PLUGINS = 1;
# QT_QPA_PLATFORM_PLUGIN_PATH = "${qt5.qtbase.bin}/lib/qt-${qt5.qtbase.version}/plugins/platforms";
qtWrapperArgs = [
"--set QT_DEBUG_PLUGINS 1"
"--set QT_QPA_PLATFORM_PLUGIN_PATH ${qt5.qtbase.bin}/lib/qt-${qt5.qtbase.version}/plugins/platforms"
];
platforms = [
"aarch64-darwin"
"x86_64-darwin"

buildInputs = [
alsa-lib
openssl
pulseaudio
libsForQt5.qt5.qtspeech
libsForQt5.qt5.qtmultimedia
libsForQt5.qt5.qtx11extras
qt5.qtbase
xorg.libX11
xorg.libXScrnSaver
];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
})

nativeBuildInputs =
[
autoPatchelfHook
qt5.wrapQtAppsHook
makeWrapper
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
xar
cpio
];

# passthru.updateScript = lib.getExe (writeShellApplication {
# name = "teamtalk5-update-script"
# text = throw "TODO";
# });

meta = {
description = "TeamTalk 5 is a freeware conferencing system which allows multiple users to participate in audio and video conversations.";
homepage = "https://bearware.dk";
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [
_347online
];
platforms = [
"aarch64-darwin"
"x86_64-darwin"
"x86_64-linux"
];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
}
)

0 comments on commit 4dec315

Please sign in to comment.