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.

103 lines
3.0 KiB
Nix
Raw Normal View History

2022-12-07 18:47:45 +00:00
{ lib
, stdenv
, fetchFromGitHub
, makeWrapper
, makeDesktopItem
, copyDesktopItems
, yarn
, nodejs
, fetchYarnDeps
, fixup_yarn_lock
2022-12-07 18:47:45 +00:00
, electron
, libpulseaudio
, pipewire
, alsa-utils
2022-12-07 18:47:45 +00:00
}:
stdenv.mkDerivation rec {
pname = "teams-for-linux";
2023-04-12 15:42:03 +00:00
version = "1.0.59";
2022-12-07 18:47:45 +00:00
src = fetchFromGitHub {
owner = "IsmaelMartinez";
repo = pname;
rev = "v${version}";
2023-04-12 15:42:03 +00:00
sha256 = "sha256-82uRZEktKHMQhozG5Zpa2DFu1VZOEDBWpsbfgMzoXY8=";
2022-12-07 18:47:45 +00:00
};
offlineCache = fetchYarnDeps {
yarnLock = "${src}/yarn.lock";
sha256 = "sha256-3zjmVIPQ+F2jPQ2xkAv5hQUjr8k5jIHTsa73J+IMayw=";
2022-12-07 18:47:45 +00:00
};
nativeBuildInputs = [ yarn fixup_yarn_lock nodejs copyDesktopItems makeWrapper ];
configurePhase = ''
runHook preConfigure
export HOME=$(mktemp -d)
yarn config --offline set yarn-offline-mirror $offlineCache
fixup_yarn_lock yarn.lock
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"} \
2022-12-07 18:47:45 +00:00
-c.electronDist=${electron}/lib/electron \
-c.electronVersion=${electron.version}
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, and 'libpipewire' for screen sharing
2022-12-07 18:47:45 +00:00
makeWrapper '${electron}/bin/electron' "$out/bin/teams-for-linux" \
${lib.optionalString stdenv.isLinux ''
--prefix PATH : ${lib.makeBinPath [ alsa-utils ]} \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libpulseaudio pipewire ]} \
''} \
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 {
name = pname;
exec = pname;
icon = pname;
desktopName = "Microsoft Teams for Linux";
comment = meta.description;
categories = [ "Network" "InstantMessaging" "Chat" ];
})];
2023-03-21 23:34:23 +00:00
passthru.updateScript = ./update.sh;
2022-12-07 18:47:45 +00:00
meta = with lib; {
description = "Unofficial Microsoft Teams client for Linux";
homepage = "https://github.com/IsmaelMartinez/teams-for-linux";
license = licenses.gpl3Only;
maintainers = with maintainers; [ muscaln lilyinstarlight ];
platforms = platforms.unix;
broken = stdenv.isDarwin;
2022-12-07 18:47:45 +00:00
};
}