mattermost-desktop: 4.6.2 -> 5.0.3

This commit is contained in:
Olli Helenius 2021-11-02 19:42:57 +02:00
parent 61b935bad9
commit f13b40ab4e
No known key found for this signature in database
GPG Key ID: 67235CC88F41DE3C

View File

@ -1,132 +1,83 @@
{ lib
, stdenv
, fetchurl
, gnome2
, gtk3
, pango
, atk
, cairo
, gdk-pixbuf
, glib
, freetype
, fontconfig
, dbus
, libX11
, xorg
, libXi
, libXcursor
, libXdamage
, libXrandr
, libXcomposite
, libXext
, libXfixes
, libXrender
, libXtst
, libXScrnSaver
, nss
, nspr
, alsa-lib
, cups
, expat
, udev
, wrapGAppsHook
, hicolor-icon-theme
, libuuid
, at-spi2-core
, at-spi2-atk
, atomEnv
, systemd
, pulseaudio
, libxshmfence
, libnotify
, libappindicator-gtk3
, wrapGAppsHook
, autoPatchelfHook
}:
let
rpath = lib.makeLibraryPath [
alsa-lib
at-spi2-atk
at-spi2-core
atk
cairo
cups
dbus
expat
fontconfig
freetype
gdk-pixbuf
glib
gnome2.GConf
gtk3
pango
libappindicator-gtk3
libuuid
libX11
libXScrnSaver
libXcomposite
libXcursor
libXdamage
libXext
libXfixes
libXi
libXrandr
libXrender
libXtst
nspr
nss
stdenv.cc.cc
udev
xorg.libxcb
];
pname = "mattermost-desktop";
version = "5.0.3";
srcs = {
"x86_64-linux" = {
url = "https://releases.mattermost.com/desktop/${version}/${pname}-${version}-linux-x64.tar.gz";
hash = "sha256-KLSWJpNSMGmfugbkFIJLDnxcZtrtBZOGjLlR+kAoMTA=";
};
"i686-linux" = {
url = "https://releases.mattermost.com/desktop/${version}/${pname}-${version}-linux-ia32.tar.gz";
hash = "sha256-4ofjOsfGbgO1PSqQpigNp90JsvlGP1kGexVAR/h3/88=";
};
};
inherit (stdenv.hostPlatform) system;
in
stdenv.mkDerivation rec {
pname = "mattermost-desktop";
version = "4.6.2";
src =
if stdenv.hostPlatform.system == "x86_64-linux" then
fetchurl
{
url = "https://releases.mattermost.com/desktop/${version}/${pname}-${version}-linux-x64.tar.gz";
sha256 = "0i836bc0gx375a9fm2cdxg84k03zhpx1z6jqxndf2m8pkfsblc3x";
}
else if stdenv.hostPlatform.system == "i686-linux" then
fetchurl
{
url = "https://releases.mattermost.com/desktop/${version}/${pname}-${version}-linux-ia32.tar.gz";
sha256 = "04jv9hkmkh0jipv0fjdprnp5kmkjvf3c0fah6ysi21wmnmp5ab3m";
}
else
throw "Mattermost-Desktop is not currently supported on ${stdenv.hostPlatform.system}";
stdenv.mkDerivation {
inherit pname version;
src = fetchurl (srcs."${system}" or (throw "Unsupported system ${system}"));
dontBuild = true;
dontConfigure = true;
dontPatchELF = true;
dontStrip = true;
nativeBuildInputs = [ wrapGAppsHook ];
nativeBuildInputs = [ wrapGAppsHook autoPatchelfHook ];
buildInputs = [ gtk3 hicolor-icon-theme ];
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
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 \
substituteInPlace $out/share/applications/Mattermost.desktop \
--replace /share/mattermost-desktop/mattermost-desktop /bin/mattermost-desktop
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${rpath}:$out/share/mattermost-desktop" \
$out/share/mattermost-desktop/mattermost-desktop
runHook postInstall
'';