2
0
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-14 01:33:10 +00:00
nixpkgs/pkgs/applications/networking/instant-messengers/mattermost-desktop/default.nix

93 lines
2.4 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ lib
, stdenv
, fetchurl
, atomEnv
, systemd
, pulseaudio
, libxshmfence
, libnotify
, libappindicator-gtk3
, wrapGAppsHook
, autoPatchelfHook
}:
let
pname = "mattermost-desktop";
version = "5.1.0";
srcs = {
"x86_64-linux" = {
url = "https://releases.mattermost.com/desktop/${version}/${pname}-${version}-linux-x64.tar.gz";
hash = "sha256-KmtQUqg2ODbZ6zJjsnwlvB+vhR1xbK2X9qqmZpyTR78=";
};
"i686-linux" = {
url = "https://releases.mattermost.com/desktop/${version}/${pname}-${version}-linux-ia32.tar.gz";
hash = "sha256-X8Zrthw1hZOqmcYidt72l2vonh31iiA3EDGmCQr7e4c=";
};
};
inherit (stdenv.hostPlatform) system;
in
stdenv.mkDerivation {
inherit pname version;
src = fetchurl (srcs."${system}" or (throw "Unsupported system ${system}"));
dontBuild = true;
dontConfigure = true;
dontStrip = true;
nativeBuildInputs = [ wrapGAppsHook autoPatchelfHook ];
buildInputs = atomEnv.packages ++ [
libxshmfence
];
runtimeDependencies = [
(lib.getLib systemd)
pulseaudio
libnotify
libappindicator-gtk3
];
installPhase = ''
runHook preInstall
# Mattermost tarball comes with executable bit set for everything.
# Well apply it only to files that need it.
find . -type f -print0 | xargs -0 chmod -x
find . -type f \( -name '*.so.*' -o -name '*.s[oh]' \) -print0 | xargs -0 chmod +x
chmod +x mattermost-desktop chrome-sandbox
mkdir -p $out/share/mattermost-desktop
cp -R . $out/share/mattermost-desktop
mkdir -p "$out/bin"
ln -s $out/share/mattermost-desktop/mattermost-desktop $out/bin/mattermost-desktop
patchShebangs $out/share/mattermost-desktop/create_desktop_file.sh
$out/share/mattermost-desktop/create_desktop_file.sh
rm $out/share/mattermost-desktop/create_desktop_file.sh
mkdir -p $out/share/applications
chmod -x Mattermost.desktop
mv Mattermost.desktop $out/share/applications/Mattermost.desktop
substituteInPlace $out/share/applications/Mattermost.desktop \
--replace /share/mattermost-desktop/mattermost-desktop /bin/mattermost-desktop
runHook postInstall
'';
meta = with lib; {
description = "Mattermost Desktop client";
homepage = "https://about.mattermost.com/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.asl20;
platforms = [ "x86_64-linux" "i686-linux" ];
maintainers = [ maintainers.joko ];
};
}