Merge pull request #257818 from wamserma/teams-linux-webp-insecure

teams: remove (linux)
This commit is contained in:
Maximilian Bosch 2023-09-29 09:42:36 +02:00 committed by GitHub
commit 2fd56dd3a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,11 +24,9 @@
let
pname = "teams";
versions = {
linux = "1.5.00.23861";
darwin = "1.6.00.4464";
};
hashes = {
linux = "sha256-h0YnCeJX//l4TegJVZtavV3HrxjYUF2Fa5KmaYmZW8E=";
darwin = "sha256-DvXMrXotKWUqFCb7rZj8wU7mmZJKuTLGyx8qOB/aQtg=";
};
meta = with lib; {
@ -38,112 +36,10 @@ let
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
maintainers = with maintainers; [ liff tricktron ];
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
platforms = [ "x86_64-darwin" "aarch64-darwin" ];
mainProgram = "teams";
};
linux = stdenv.mkDerivation rec {
inherit pname meta;
version = versions.linux;
src = fetchurl {
urls = [
"https://packages.microsoft.com/repos/ms-teams/pool/main/t/teams/teams_${versions.linux}_amd64.deb"
# NOTE: the archive.org timestamp must also be updated if the version changes.
"https://web.archive.org/web/20221130115842if_/https://packages.microsoft.com/repos/ms-teams/pool/main/t/teams/teams_${versions.linux}_amd64.deb"
];
hash = hashes.linux;
};
nativeBuildInputs = [ dpkg autoPatchelfHook wrapGAppsHook asar ];
unpackCmd = "dpkg -x $curSrc .";
buildInputs = atomEnv.packages ++ [
libuuid
at-spi2-atk
];
runtimeDependencies = [
(lib.getLib systemd)
pulseaudio
libappindicator-gtk3
];
preFixup = ''
gappsWrapperArgs+=(
--prefix PATH : "${coreutils}/bin:${gawk}/bin"
# fix for https://docs.microsoft.com/en-us/answers/questions/298724/open-teams-meeting-link-on-linux-doens39t-work.html?childToView=309406#comment-309406
--append-flags '--disable-namespace-sandbox --disable-setuid-sandbox'
)
'';
buildPhase = ''
runHook preBuild
asar extract share/teams/resources/app.asar "$TMP/work"
substituteInPlace $TMP/work/main.bundle.js \
--replace "/usr/share/pixmaps/" "$out/share/pixmaps" \
--replace "/usr/bin/xdg-mime" "${xdg-utils}/bin/xdg-mime" \
--replace "Exec=/usr/bin/" "Exec=" # Remove usage of absolute path in autostart.
asar pack --unpack='{*.node,*.ftz,rect-overlay}' "$TMP/work" share/teams/resources/app.asar
runHook postBuild
'';
preferLocalBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out/{opt,bin}
mv share/teams $out/opt/
mv share $out/share
mkdir -p $out/share/icons/hicolor/512x512/apps
mv $out/share/pixmaps/teams.png $out/share/icons/hicolor/512x512/apps
rmdir $out/share/pixmaps
substituteInPlace $out/share/applications/teams.desktop \
--replace /usr/bin/ ""
ln -s $out/opt/teams/teams $out/bin/
${lib.optionalString (!enableRectOverlay) ''
# 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
''}
runHook postInstall
'';
dontAutoPatchelf = true;
# Includes runtimeDependencies in the RPATH of the included Node modules
# so that dynamic loading works. We cannot use directly runtimeDependencies
# here, since the libraries from runtimeDependencies are not propagated
# to the dynamically loadable node modules because of a condition in
# autoPatchElfHook since *.node modules have Type: DYN (Shared object file)
# instead of EXEC or INTERP it expects.
# Fixes: https://github.com/NixOS/nixpkgs/issues/85449
postFixup = ''
autoPatchelf "$out"
runtime_rpath="${lib.makeLibraryPath runtimeDependencies}"
for mod in $(find "$out/opt/teams" -name '*.node'); do
mod_rpath="$(patchelf --print-rpath "$mod")"
echo "Adding runtime dependencies to RPATH of Node module $mod"
patchelf --set-rpath "$runtime_rpath:$mod_rpath" "$mod"
done;
'';
};
appName = "Teams.app";
darwin = stdenv.mkDerivation {
@ -178,4 +74,4 @@ let
in
if stdenv.isDarwin
then darwin
else linux
else throw "Teams app for Linux has been removed as it is unmaintained by upstream. (2023-09-29)"