diff --git a/pkgs/applications/networking/instant-messengers/teams-for-linux/default.nix b/pkgs/applications/networking/instant-messengers/teams-for-linux/default.nix deleted file mode 100644 index f59b9c3774bc6..0000000000000 --- a/pkgs/applications/networking/instant-messengers/teams-for-linux/default.nix +++ /dev/null @@ -1,107 +0,0 @@ -{ lib -, stdenv -, fetchFromGitHub -, makeWrapper -, makeDesktopItem -, copyDesktopItems -, yarn -, nodejs -, fetchYarnDeps -, fixup-yarn-lock -, electron -, alsa-utils -, which -, testers -, teams-for-linux -}: - -stdenv.mkDerivation (finalAttrs: { - pname = "teams-for-linux"; - version = "1.4.27"; - - src = fetchFromGitHub { - owner = "IsmaelMartinez"; - repo = "teams-for-linux"; - rev = "v${finalAttrs.version}"; - hash = "sha256-nUHiveS1XI+vC2Tj1DK/DS4CrKTLMg1IYgTPWXuLrAc="; - }; - - offlineCache = fetchYarnDeps { - yarnLock = "${finalAttrs.src}/yarn.lock"; - hash = "sha256-jBwyIyiWeqNmOnxmVOr7c4oMWwHElEjM25sShhTMi78="; - }; - - 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"} \ - -c.electronDist=${electron}/libexec/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/ - - 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 - makeWrapper '${electron}/bin/electron' "$out/bin/teams-for-linux" \ - ${lib.optionalString stdenv.isLinux '' - --prefix PATH : ${lib.makeBinPath [ alsa-utils which ]} \ - ''} \ - --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 = finalAttrs.pname; - exec = finalAttrs.pname; - icon = finalAttrs.pname; - desktopName = "Microsoft Teams for Linux"; - comment = finalAttrs.meta.description; - categories = [ "Network" "InstantMessaging" "Chat" ]; - })]; - - passthru.updateScript = ./update.sh; - passthru.tests.version = testers.testVersion rec { - package = teams-for-linux; - command = "HOME=$TMPDIR ${package.meta.mainProgram or package.pname} --version"; - }; - - meta = { - description = "Unofficial Microsoft Teams client for Linux"; - mainProgram = "teams-for-linux"; - homepage = "https://github.com/IsmaelMartinez/teams-for-linux"; - license = lib.licenses.gpl3Only; - maintainers = with lib.maintainers; [ muscaln lilyinstarlight qjoly chvp ]; - platforms = lib.platforms.unix; - broken = stdenv.isDarwin; - }; -}) diff --git a/pkgs/applications/networking/instant-messengers/teams-for-linux/update.sh b/pkgs/applications/networking/instant-messengers/teams-for-linux/update.sh deleted file mode 100755 index 650edf188611f..0000000000000 --- a/pkgs/applications/networking/instant-messengers/teams-for-linux/update.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i bash -p nix jq common-updater-scripts - -set -euo pipefail - -nixpkgs="$(git rev-parse --show-toplevel || (printf 'Could not find root of nixpkgs repo\nAre we running from within the nixpkgs git repo?\n' >&2; exit 1))" - -stripwhitespace() { - sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -} - -nixeval() { - nix --extra-experimental-features nix-command eval --json --impure -f "$nixpkgs" "$1" | jq -r . -} - -vendorhash() { - (nix --extra-experimental-features nix-command build --impure --argstr nixpkgs "$nixpkgs" --argstr attr "$1" --expr '{ nixpkgs, attr }: let pkgs = import nixpkgs {}; in with pkgs.lib; (getAttrFromPath (splitString "." attr) pkgs).overrideAttrs (attrs: { outputHash = fakeHash; })' --no-link 2>&1 >/dev/null | tail -n3 | grep -F got: | cut -d: -f2- | stripwhitespace) 2>/dev/null || true -} - -findpath() { - path="$(nix --extra-experimental-features nix-command eval --json --impure -f "$nixpkgs" "$1.meta.position" | jq -r . | cut -d: -f1)" - outpath="$(nix --extra-experimental-features nix-command eval --json --impure --expr "builtins.fetchGit \"$nixpkgs\"")" - - if [ -n "$outpath" ]; then - path="${path/$(echo "$outpath" | jq -r .)/$nixpkgs}" - fi - - echo "$path" -} - -attr="${UPDATE_NIX_ATTR_PATH:-teams-for-linux}" -version="$(cd "$nixpkgs" && list-git-tags --pname="$(nixeval "$attr".pname)" --attr-path="$attr" | grep '^v' | sed -e 's|^v||' | sort -V | tail -n1)" - -pkgpath="$(findpath "$attr")" - -updated="$(cd "$nixpkgs" && update-source-version "$attr" "$version" --file="$pkgpath" --print-changes | jq -r length)" - -if [ "$updated" -eq 0 ]; then - echo 'update.sh: Package version not updated, nothing to do.' - exit 0 -fi - -curhash="$(nixeval "$attr.offlineCache.outputHash")" -newhash="$(vendorhash "$attr.offlineCache")" - -if [ -n "$newhash" ] && [ "$curhash" != "$newhash" ]; then - sed -i -e "s|\"$curhash\"|\"$newhash\"|" "$pkgpath" -else - echo 'update.sh: New vendorHash same as old vendorHash, nothing to do.' -fi diff --git a/pkgs/by-name/te/teams-for-linux/package.nix b/pkgs/by-name/te/teams-for-linux/package.nix new file mode 100644 index 0000000000000..1abff281edb95 --- /dev/null +++ b/pkgs/by-name/te/teams-for-linux/package.nix @@ -0,0 +1,124 @@ +{ + lib, + stdenv, + buildNpmPackage, + fetchFromGitHub, + alsa-utils, + copyDesktopItems, + electron_30, + makeDesktopItem, + makeWrapper, + nix-update-script, + which, +}: + +let + electronDist = "${electron_30}/${if stdenv.isDarwin then "Applications" else "libexec/electron"}"; +in +buildNpmPackage rec { + pname = "teams-for-linux"; + version = "1.9.5"; + + src = fetchFromGitHub { + owner = "IsmaelMartinez"; + repo = "teams-for-linux"; + rev = "refs/tags/v${version}"; + hash = "sha256-+rEGDg+/qvjCMhGHccb4p+CKOo/65RpkFT/WnCDlCgU="; + }; + + npmDepsHash = "sha256-vDRFFxkIQo5qU9gmkSwUhPz4FG2XbUNkTw6SCuvMqCc="; + + nativeBuildInputs = [ + makeWrapper + ] ++ lib.optionals (stdenv.isLinux) [ copyDesktopItems ]; + + env = { + # disable code signing on Darwin + CSC_IDENTITY_AUTO_DISCOVERY = "false"; + ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; + }; + + buildPhase = '' + runHook preBuild + + cp -r ${electronDist} electron-dist + chmod -R u+w electron-dist + + npm exec electron-builder -- \ + --dir \ + -c.npmRebuild=true \ + -c.asarUnpack="**/*.node" \ + -c.electronDist=electron-dist \ + -c.electronVersion=${electron_30.version} + + runHook postBuild + ''; + + installPhase = + '' + runHook preInstall + + '' + + lib.optionalString stdenv.isLinux '' + mkdir -p $out/share/{applications,teams-for-linux} + cp dist/*-unpacked/resources/app.asar $out/share/teams-for-linux/ + + 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 + makeWrapper '${lib.getExe electron_30}' "$out/bin/teams-for-linux" \ + --prefix PATH : ${ + lib.makeBinPath [ + alsa-utils + which + ] + } \ + --add-flags "$out/share/teams-for-linux/app.asar" \ + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" + '' + + lib.optionalString stdenv.isDarwin '' + mkdir -p $out/Applications + cp -r dist/mac*/teams-for-linux.app $out/Applications + makeWrapper $out/Applications/teams-for-linux.app/Contents/MacOS/teams-for-linux $out/bin/teams-for-linux + '' + + '' + + runHook postInstall + ''; + + desktopItems = [ + (makeDesktopItem { + name = "teams-for-linux"; + exec = "teams-for-linux"; + icon = "teams-for-linux"; + desktopName = "Microsoft Teams for Linux"; + comment = meta.description; + categories = [ + "Network" + "InstantMessaging" + "Chat" + ]; + }) + ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Unofficial Microsoft Teams client for Linux"; + mainProgram = "teams-for-linux"; + homepage = "https://github.com/IsmaelMartinez/teams-for-linux"; + license = lib.licenses.gpl3Plus; + maintainers = with lib.maintainers; [ + muscaln + qjoly + chvp + khaneliman + ]; + platforms = with lib.platforms; darwin ++ linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8069364dc4563..dccff2b34ddd9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -34633,10 +34633,6 @@ with pkgs; teams = callPackage ../applications/networking/instant-messengers/teams { }; - teams-for-linux = callPackage ../applications/networking/instant-messengers/teams-for-linux { - electron = electron_29; - }; - teamspeak_client = libsForQt5.callPackage ../applications/networking/instant-messengers/teamspeak/client.nix { }; teamspeak5_client = callPackage ../applications/networking/instant-messengers/teamspeak/client5.nix { }; teamspeak_server = callPackage ../applications/networking/instant-messengers/teamspeak/server.nix { };