slack: add MacOS target

This commit is contained in:
Ersin Akinci 2020-02-17 21:35:43 +00:00
parent 9992702e4b
commit 27d44b5156

View File

@ -8,6 +8,33 @@ let
version = "4.2.0";
inherit (stdenv.hostPlatform) system;
throwSystem = throw "Unsupported system: ${system}";
pname = "slack";
sha256 = {
x86_64-darwin = "0947a98m7yz4hldjvcqnv9s17dpvlsk9sflc1zc99hf500zck0w1";
x86_64-linux = "01b2klhky04fijdqcpfafgdqx2c5nh2fpnzvzgvz10hv7h16cinv";
}.${system} or throwSystem;
meta = with stdenv.lib; {
description = "Desktop client for Slack";
homepage = https://slack.com;
license = licenses.unfree;
maintainers = [ maintainers.mmahut ];
platforms = [ "x86_64-darwin" "x86_64-linux" ];
};
linux = stdenv.mkDerivation rec {
inherit pname version meta;
src = fetchurl {
url = "https://downloads.slack-edge.com/linux_releases/slack-desktop-${version}-amd64.deb";
inherit sha256;
};
rpath = stdenv.lib.makeLibraryPath [
alsaLib
at-spi2-atk
@ -49,21 +76,6 @@ let
xorg.libXScrnSaver
] + ":${stdenv.cc.cc.lib}/lib64";
src =
if stdenv.hostPlatform.system == "x86_64-linux" then
fetchurl {
url = "https://downloads.slack-edge.com/linux_releases/slack-desktop-${version}-amd64.deb";
sha256 = "01b2klhky04fijdqcpfafgdqx2c5nh2fpnzvzgvz10hv7h16cinv";
}
else
throw "Slack is not supported on ${stdenv.hostPlatform.system}";
in stdenv.mkDerivation {
pname = "slack";
inherit version;
inherit src;
buildInputs = [
gtk3 # needed for GSETTINGS_SCHEMAS_PATH
];
@ -116,12 +128,26 @@ in stdenv.mkDerivation {
EOF
asar pack $out/lib/slack/resources/app.asar.unpacked $out/lib/slack/resources/app.asar
'';
meta = with stdenv.lib; {
description = "Desktop client for Slack";
homepage = https://slack.com;
license = licenses.unfree;
maintainers = [ maintainers.mmahut ];
platforms = [ "x86_64-linux" ];
};
}
darwin = stdenv.mkDerivation {
inherit pname version meta;
phases = [ "installPhase" ];
src = fetchurl {
url = "https://downloads.slack-edge.com/mac_releases/Slack-${version}-macOS.dmg";
inherit sha256;
};
installPhase = ''
/usr/bin/hdiutil mount -nobrowse -mountpoint slack-mnt $src
mkdir -p $out/Applications
cp -r ./slack-mnt/Slack.app $out/Applications
/usr/bin/hdiutil unmount slack-mnt
defaults write com.tinyspeck.slackmacgap SlackNoAutoUpdates -bool YES
'';
};
in if stdenv.isDarwin
then darwin
else linux