nixpkgs/pkgs/applications/networking/instant-messengers/teams-for-linux/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

112 lines
3.4 KiB
Nix
Raw Normal View History

2022-12-07 18:47:45 +00:00
{ lib
, stdenv
, fetchFromGitHub
, makeWrapper
, makeDesktopItem
, copyDesktopItems
, yarn
, nodejs
, fetchYarnDeps
, prefetch-yarn-deps
, electron
, libnotify
, libpulseaudio
, pipewire
, alsa-utils
, which
, testers
, teams-for-linux
2022-12-07 18:47:45 +00:00
}:
2023-06-30 14:05:11 +00:00
stdenv.mkDerivation (finalAttrs: {
2022-12-07 18:47:45 +00:00
pname = "teams-for-linux";
version = "1.4.27";
2022-12-07 18:47:45 +00:00
src = fetchFromGitHub {
owner = "IsmaelMartinez";
2023-06-30 14:05:11 +00:00
repo = "teams-for-linux";
rev = "v${finalAttrs.version}";
hash = "sha256-nUHiveS1XI+vC2Tj1DK/DS4CrKTLMg1IYgTPWXuLrAc=";
2022-12-07 18:47:45 +00:00
};
offlineCache = fetchYarnDeps {
2023-06-30 14:05:11 +00:00
yarnLock = "${finalAttrs.src}/yarn.lock";
hash = "sha256-jBwyIyiWeqNmOnxmVOr7c4oMWwHElEjM25sShhTMi78=";
2022-12-07 18:47:45 +00:00
};
nativeBuildInputs = [ yarn prefetch-yarn-deps nodejs copyDesktopItems makeWrapper ];
2022-12-07 18:47:45 +00:00
configurePhase = ''
runHook preConfigure
export HOME=$(mktemp -d)
yarn config --offline set yarn-offline-mirror $offlineCache
fixup-yarn-lock yarn.lock
2022-12-07 18:47:45 +00:00
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
patchShebangs node_modules/
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
yarn --offline electron-builder \
--dir ${if stdenv.isDarwin then "--macos" else "--linux"} ${if stdenv.hostPlatform.isAarch64 then "--arm64" else "--x64"} \
-c.electronDist=${electron}/libexec/electron \
-c.electronVersion=${electron.version}
2022-12-07 18:47:45 +00:00
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/share/{applications,teams-for-linux}
cp dist/${if stdenv.isDarwin then "darwin-" else "linux-"}${lib.optionalString stdenv.hostPlatform.isAarch64 "arm64-"}unpacked/resources/app.asar $out/share/teams-for-linux/
2022-12-07 18:47:45 +00:00
pushd build/icons
for image in *png; do
mkdir -p $out/share/icons/hicolor/''${image%.png}/apps
cp -r $image $out/share/icons/hicolor/''${image%.png}/apps/teams-for-linux.png
done
popd
# Linux needs 'aplay' for notification sounds, 'libpulse' for meeting sound, 'libpipewire' for screen sharing and 'libnotify' for notifications
makeWrapper '${electron}/bin/electron' "$out/bin/teams-for-linux" \
${lib.optionalString stdenv.isLinux ''
--prefix PATH : ${lib.makeBinPath [ alsa-utils which ]} \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libpulseaudio pipewire libnotify ]} \
''} \
2022-12-07 18:47:45 +00:00
--add-flags "$out/share/teams-for-linux/app.asar" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
runHook postInstall
'';
desktopItems = [(makeDesktopItem {
2023-06-30 14:05:11 +00:00
name = finalAttrs.pname;
exec = finalAttrs.pname;
icon = finalAttrs.pname;
2022-12-07 18:47:45 +00:00
desktopName = "Microsoft Teams for Linux";
2023-06-30 14:05:11 +00:00
comment = finalAttrs.meta.description;
2022-12-07 18:47:45 +00:00
categories = [ "Network" "InstantMessaging" "Chat" ];
})];
2023-03-21 23:34:23 +00:00
passthru.updateScript = ./update.sh;
passthru.tests.version = testers.testVersion rec {
package = teams-for-linux;
command = "HOME=$TMPDIR ${package.meta.mainProgram or package.pname} --version";
};
2023-03-21 23:34:23 +00:00
2023-06-30 14:05:11 +00:00
meta = {
2022-12-07 18:47:45 +00:00
description = "Unofficial Microsoft Teams client for Linux";
mainProgram = "teams-for-linux";
2022-12-07 18:47:45 +00:00
homepage = "https://github.com/IsmaelMartinez/teams-for-linux";
2023-06-30 14:05:11 +00:00
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ muscaln lilyinstarlight qjoly chvp ];
2023-06-30 14:05:11 +00:00
platforms = lib.platforms.unix;
broken = stdenv.isDarwin;
2022-12-07 18:47:45 +00:00
};
2023-06-30 14:05:11 +00:00
})