nixpkgs/pkgs/applications/networking/instant-messengers/mattermost-desktop/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

93 lines
2.4 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchurl
2021-11-02 17:42:57 +00:00
, atomEnv
, systemd
, pulseaudio
, libxshmfence
, libnotify
, libappindicator-gtk3
2021-11-02 17:42:57 +00:00
, wrapGAppsHook
, autoPatchelfHook
}:
let
pname = "mattermost-desktop";
2022-06-18 09:31:42 +00:00
version = "5.1.0";
2021-11-02 17:42:57 +00:00
srcs = {
"x86_64-linux" = {
url = "https://releases.mattermost.com/desktop/${version}/${pname}-${version}-linux-x64.tar.gz";
2022-06-18 09:31:42 +00:00
hash = "sha256-KmtQUqg2ODbZ6zJjsnwlvB+vhR1xbK2X9qqmZpyTR78=";
2021-11-02 17:42:57 +00:00
};
"i686-linux" = {
url = "https://releases.mattermost.com/desktop/${version}/${pname}-${version}-linux-ia32.tar.gz";
2022-06-18 09:31:42 +00:00
hash = "sha256-X8Zrthw1hZOqmcYidt72l2vonh31iiA3EDGmCQr7e4c=";
2021-11-02 17:42:57 +00:00
};
};
inherit (stdenv.hostPlatform) system;
in
stdenv.mkDerivation {
inherit pname version;
src = fetchurl (srcs."${system}" or (throw "Unsupported system ${system}"));
dontBuild = true;
dontConfigure = true;
2021-11-02 17:42:57 +00:00
dontStrip = true;
2019-02-25 09:13:49 +00:00
2021-11-02 17:42:57 +00:00
nativeBuildInputs = [ wrapGAppsHook autoPatchelfHook ];
2021-11-02 17:42:57 +00:00
buildInputs = atomEnv.packages ++ [
libxshmfence
];
runtimeDependencies = [
(lib.getLib systemd)
pulseaudio
libnotify
libappindicator-gtk3
];
installPhase = ''
runHook preInstall
2021-11-02 17:42:57 +00:00
# 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"
2021-11-02 17:42:57 +00:00
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
2021-11-02 17:42:57 +00:00
chmod -x Mattermost.desktop
mv Mattermost.desktop $out/share/applications/Mattermost.desktop
2021-11-02 17:42:57 +00:00
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 ];
};
}