2019-12-11 13:38:30 +01:00
{ lib
, stdenv
, fetchurl
, autoPatchelfHook
, wrapGAppsHook
, dpkg
, atomEnv
, libuuid
, pulseaudio
, at-spi2-atk
, coreutils
, gawk
2021-02-01 09:05:09 +01:00
, xdg-utils
2019-12-11 13:38:30 +01:00
, systemd } :
stdenv . mkDerivation rec {
pname = " t e a m s " ;
2021-03-11 20:28:47 +01:00
version = " 1 . 4 . 0 0 . 4 8 5 5 " ;
2019-12-11 13:38:30 +01:00
src = fetchurl {
url = " h t t p s : / / p a c k a g e s . m i c r o s o f t . c o m / r e p o s / m s - t e a m s / p o o l / m a i n / t / t e a m s / t e a m s _ ${ version } _ a m d 6 4 . d e b " ;
2021-03-11 20:28:47 +01:00
sha256 = " 1 g 0 l s y d z 4 l 5 3 6 q f 8 9 0 d r d z 6 g 8 6 x b 0 s m 3 3 2 6 h z 3 y m j 9 p i 8 v v b s 7 d 9 " ;
2019-12-11 13:38:30 +01:00
} ;
nativeBuildInputs = [ dpkg autoPatchelfHook wrapGAppsHook ] ;
unpackCmd = " d p k g - x $ c u r S r c . " ;
buildInputs = atomEnv . packages ++ [
libuuid
at-spi2-atk
] ;
runtimeDependencies = [
2020-08-12 20:13:48 +02:00
( lib . getLib systemd )
2019-12-11 13:38:30 +01:00
pulseaudio
] ;
preFixup = ''
2021-02-01 09:05:09 +01:00
gappsWrapperArgs + = ( - - prefix PATH : " ${ coreutils } / b i n : ${ gawk } / b i n : ${ xdg-utils } / b i n " )
2021-03-11 20:28:47 +01:00
gappsWrapperArgs + = ( - - add-flags - - disable-namespace-sandbox )
gappsWrapperArgs + = ( - - add-flags - - disable-setuid-sandbox )
2019-12-11 13:38:30 +01:00
'' ;
installPhase = ''
2021-03-11 20:28:47 +01:00
runHook preInstall
2019-12-11 13:38:30 +01:00
mkdir - p $ out / { opt , bin }
mv share/teams $ out/opt /
mv share $ out/share
substituteInPlace $ out/share/applications/teams.desktop \
2020-11-05 02:12:49 +01:00
- - replace /usr/bin / " "
2019-12-11 13:38:30 +01:00
ln - s $ out/opt/teams/teams $ out/bin /
2020-10-28 09:39:08 +01:00
# Work-around screen sharing bug
# https://docs.microsoft.com/en-us/answers/questions/42095/sharing-screen-not-working-anymore-bug.html
rm $ out/opt/teams/resources/app.asar.unpacked/node_modules/slimcore/bin/rect-overlay
2021-03-11 20:28:47 +01:00
runHook postInstall
2019-12-11 13:38:30 +01:00
'' ;
2020-04-17 18:23:31 +02:00
dontAutoPatchelf = true ;
# Includes runtimeDependencies in the RPATH of the included Node modules
# so that dynamic loading works. We cannot use directly runtimeDependencies
2020-07-01 20:27:05 +02:00
# here, since the libraries from runtimeDependencies are not propagated
2020-04-17 18:23:31 +02:00
# to the dynamically loadable node modules because of a condition in
2020-07-01 20:27:05 +02:00
# autoPatchElfHook since *.node modules have Type: DYN (Shared object file)
2020-04-17 18:23:31 +02:00
# instead of EXEC or INTERP it expects.
# Fixes: https://github.com/NixOS/nixpkgs/issues/85449
postFixup = ''
autoPatchelf " $ o u t "
runtime_rpath = " ${ lib . makeLibraryPath runtimeDependencies } "
for mod in $ ( find " $ o u t / o p t / t e a m s " - name ' * . node' ) ; do
mod_rpath = " $ ( p a t c h e l f - - p r i n t - r p a t h " $ mod " ) "
echo " A d d i n g r u n t i m e d e p e n d e n c i e s t o R P A T H o f N o d e m o d u l e $ m o d "
patchelf - - set-rpath " $ r u n t i m e _ r p a t h : $ m o d _ r p a t h " " $ m o d "
done ;
2021-03-17 11:42:31 +01:00
# fix for https://docs.microsoft.com/en-us/answers/questions/298724/open-teams-meeting-link-on-linux-doens39t-work.html?childToView=309406#comment-309406
# while we create the wrapper ourselves, gappsWrapperArgs leads to the same issue
# another option would be to introduce gappsWrapperAppendedArgs, to allow control of positioning
substituteInPlace " $ o u t / b i n / t e a m s " - - replace ' . teams-wrapped " - - d i s a b l e - n a m e s p a c e - s a n d b o x - - d i s a b l e - s e t u i d - s a n d b o x " $ @ " ' ' . t e a m s - w r a p p e d " " $ @ " - - disable-namespace-sandbox - - disable-setuid-sandbox'
2020-04-17 18:23:31 +02:00
'' ;
2021-01-11 08:54:33 +01:00
meta = with lib ; {
2019-12-11 13:38:30 +01:00
description = " M i c r o s o f t T e a m s " ;
homepage = " h t t p s : / / t e a m s . m i c r o s o f t . c o m " ;
downloadPage = " h t t p s : / / t e a m s . m i c r o s o f t . c o m / d o w n l o a d s " ;
license = licenses . unfree ;
maintainers = [ maintainers . liff ] ;
platforms = [ " x 8 6 _ 6 4 - l i n u x " ] ;
} ;
}