Merge pull request #83452 from prusnak/slack

slack: 4.2.0 -> 4.4.0
This commit is contained in:
Robin Gloster 2020-03-28 12:06:19 +00:00 committed by GitHub
commit d4f08ee383
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 57 additions and 86 deletions

View File

@ -1,19 +0,0 @@
{ stdenv, fetchgit }:
stdenv.mkDerivation rec {
rev = "f760176c6e133667ce73aeecba8b0c0eb8822941";
version = "2019-09-11";
pname = "slack-theme-black";
src = fetchgit { inherit rev;
url = "https://github.com/laCour/slack-night-mode";
sha256 = "1kx8nx7mhrabs5wxqgvy86s5smy5hw49gv6yc95yxwx6ymwpgbzj";
};
dontUnpack = true;
buildCommand = ''
mkdir $out
cp $src/css/raw/black.css $out/theme.css
'';
}

View File

@ -1,35 +1,60 @@
{ theme ? null, stdenv, fetchurl, dpkg, makeWrapper , alsaLib, atk, cairo, { stdenv
cups, curl, dbus, expat, fontconfig, freetype, glib , gnome2, gtk3, gdk-pixbuf, , fetchurl
libappindicator-gtk3, libnotify, libxcb, nspr, nss, pango , systemd, xorg, , dpkg
at-spi2-atk, at-spi2-core, libuuid, nodePackages, libpulseaudio, xdg_utils , makeWrapper
, nodePackages
, alsaLib
, at-spi2-atk
, at-spi2-core
, atk
, cairo
, cups
, curl
, dbus
, expat
, fontconfig
, freetype
, gdk-pixbuf
, glib
, gnome2
, gtk3
, libappindicator-gtk3
, libnotify
, libpulseaudio
, libuuid
, libxcb
, nspr
, nss
, pango
, systemd
, xdg_utils
, xorg
}: }:
let let
version = "4.2.0"; pname = "slack";
inherit (stdenv.hostPlatform) system; inherit (stdenv.hostPlatform) system;
throwSystem = throw "Unsupported system: ${system}"; throwSystem = throw "Unsupported system: ${system}";
pname = "slack";
sha256 = { sha256 = {
x86_64-darwin = "0947a98m7yz4hldjvcqnv9s17dpvlsk9sflc1zc99hf500zck0w1"; x86_64-darwin = "05xsbiviikrwfayjr6rvvfkm70681x2an6mgcg1cxw1fsi4sr6fd";
x86_64-linux = "01b2klhky04fijdqcpfafgdqx2c5nh2fpnzvzgvz10hv7h16cinv"; x86_64-linux = "0h2rfgx92yq9a6dqsv9a0r8a6m5xfrywkljjk5w9snw49b0r1p12";
}.${system} or throwSystem; }.${system} or throwSystem;
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Desktop client for Slack"; description = "Desktop client for Slack";
homepage = https://slack.com; homepage = https://slack.com;
license = licenses.unfree; license = licenses.unfree;
maintainers = [ maintainers.mmahut ]; maintainers = with maintainers; [ mmahut ];
platforms = [ "x86_64-darwin" "x86_64-linux" ]; platforms = [ "x86_64-darwin" "x86_64-linux" ];
}; };
linux = stdenv.mkDerivation rec { linux = stdenv.mkDerivation rec {
inherit pname version meta; inherit pname meta;
version = "4.4.0";
src = fetchurl { src = fetchurl {
url = "https://downloads.slack-edge.com/linux_releases/slack-desktop-${version}-amd64.deb"; url = "https://downloads.slack-edge.com/linux_releases/slack-desktop-${version}-amd64.deb";
inherit sha256; inherit sha256;
@ -47,23 +72,22 @@ let
expat expat
fontconfig fontconfig
freetype freetype
gdk-pixbuf
glib glib
gnome2.GConf gnome2.GConf
gdk-pixbuf
gtk3 gtk3
pango
libnotify
libxcb
libappindicator-gtk3 libappindicator-gtk3
libnotify
libpulseaudio
libuuid
libxcb
nspr nspr
nss nss
pango
stdenv.cc.cc stdenv.cc.cc
systemd systemd
libuuid
libpulseaudio
xorg.libxkbfile
xorg.libX11 xorg.libX11
xorg.libXScrnSaver
xorg.libXcomposite xorg.libXcomposite
xorg.libXcursor xorg.libXcursor
xorg.libXdamage xorg.libXdamage
@ -73,65 +97,51 @@ let
xorg.libXrandr xorg.libXrandr
xorg.libXrender xorg.libXrender
xorg.libXtst xorg.libXtst
xorg.libXScrnSaver xorg.libxkbfile
] + ":${stdenv.cc.cc.lib}/lib64"; ] + ":${stdenv.cc.cc.lib}/lib64";
buildInputs = [ buildInputs = [
gtk3 # needed for GSETTINGS_SCHEMAS_PATH gtk3 # needed for GSETTINGS_SCHEMAS_PATH
]; ];
nativeBuildInputs = [ dpkg makeWrapper nodePackages.asar ]; nativeBuildInputs = [ dpkg makeWrapper nodePackages.asar ];
dontUnpack = true; dontUnpack = true;
dontBuild = true; dontBuild = true;
dontPatchELF = true; dontPatchELF = true;
installPhase = '' installPhase = ''
# The deb file contains a setuid binary, so 'dpkg -x' doesn't work here # The deb file contains a setuid binary, so 'dpkg -x' doesn't work here
dpkg --fsys-tarfile $src | tar --extract dpkg --fsys-tarfile $src | tar --extract
rm -rf usr/share/lintian rm -rf usr/share/lintian
mkdir -p $out mkdir -p $out
mv usr/* $out mv usr/* $out
# Otherwise it looks "suspicious" # Otherwise it looks "suspicious"
chmod -R g-w $out chmod -R g-w $out
for file in $(find $out -type f \( -perm /0111 -o -name \*.so\* \) ); do for file in $(find $out -type f \( -perm /0111 -o -name \*.so\* \) ); do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$file" || true patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$file" || true
patchelf --set-rpath ${rpath}:$out/lib/slack $file || true patchelf --set-rpath ${rpath}:$out/lib/slack $file || true
done done
# Replace the broken bin/slack symlink with a startup wrapper # Replace the broken bin/slack symlink with a startup wrapper
rm $out/bin/slack rm $out/bin/slack
makeWrapper $out/lib/slack/slack $out/bin/slack \ makeWrapper $out/lib/slack/slack $out/bin/slack \
--prefix XDG_DATA_DIRS : $GSETTINGS_SCHEMAS_PATH \ --prefix XDG_DATA_DIRS : $GSETTINGS_SCHEMAS_PATH \
--prefix PATH : ${xdg_utils}/bin --prefix PATH : ${xdg_utils}/bin
# Fix the desktop link # Fix the desktop link
substituteInPlace $out/share/applications/slack.desktop \ substituteInPlace $out/share/applications/slack.desktop \
--replace /usr/bin/ $out/bin/ \ --replace /usr/bin/ $out/bin/ \
--replace /usr/share/ $out/share/ --replace /usr/share/ $out/share/
'' + stdenv.lib.optionalString (theme != null) ''
asar extract $out/lib/slack/resources/app.asar $out/lib/slack/resources/app.asar.unpacked
cat <<EOF >> $out/lib/slack/resources/app.asar.unpacked/dist/ssb-interop.bundle.js
var fs = require('fs');
document.addEventListener('DOMContentLoaded', function() {
fs.readFile('${theme}/theme.css', 'utf8', function(err, css) {
let s = document.createElement('style');
s.type = 'text/css';
s.innerHTML = css;
document.head.appendChild(s);
});
});
EOF
asar pack $out/lib/slack/resources/app.asar.unpacked $out/lib/slack/resources/app.asar
''; '';
}; };
darwin = stdenv.mkDerivation { darwin = stdenv.mkDerivation rec {
inherit pname version meta; inherit pname meta;
version = "4.4.1";
phases = [ "installPhase" ]; phases = [ "installPhase" ];

View File

@ -1,19 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl common-updater-scripts jq
set -eu -o pipefail
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion slack-theme-black" | tr -d '"')"
latestSha="$(curl -L -s https://api.github.com/repos/laCour/slack-night-mode/commits\?sha\=master\&since\=${oldVersion} | jq -r '.[0].sha')"
if [ ! "null" = "${latestSha}" ]; then
latestDate="$(curl -L -s https://api.github.com/repos/laCour/slack-night-mode/commits/${latestSha} | jq '.commit.author.date' | sed 's|"\(.*\)T.*|\1|g')"
update-source-version slack-theme-black "${latestSha}" --version-key=rev
update-source-version slack-theme-black "${latestDate}" --ignore-same-hash
nixpkgs="$(git rev-parse --show-toplevel)"
default_nix="$nixpkgs/pkgs/applications/networking/instant-messengers/slack/dark-theme.nix"
git add "${default_nix}"
git commit -m "slack-theme-black: ${oldVersion} -> ${latestDate}"
else
echo "slack-theme-black is already up-to-date"
fi

View File

@ -421,6 +421,7 @@ mapAliases ({
skrooge2 = skrooge; # added 2017-02-18 skrooge2 = skrooge; # added 2017-02-18
skype = skypeforlinux; # added 2017-07-27 skype = skypeforlinux; # added 2017-07-27
skydive = throw "skydive has been removed from nixpkgs (2019-09-10)"; skydive = throw "skydive has been removed from nixpkgs (2019-09-10)";
slack-dark = slack; # added 2020-03-27
slic3r-prusa3d = prusa-slicer; # added 2019-05-21 slic3r-prusa3d = prusa-slicer; # added 2019-05-21
slurm-llnl = slurm; # renamed July 2017 slurm-llnl = slurm; # renamed July 2017
slurm-llnl-full = slurm-full; # renamed July 2017 slurm-llnl-full = slurm-full; # renamed July 2017

View File

@ -19838,8 +19838,6 @@ in
}); });
slack = callPackage ../applications/networking/instant-messengers/slack { }; slack = callPackage ../applications/networking/instant-messengers/slack { };
slack-theme-black = callPackage ../applications/networking/instant-messengers/slack/dark-theme.nix { };
slack-dark = pkgs.slack.override { theme = slack-theme-black; };
slack-cli = callPackage ../tools/networking/slack-cli { }; slack-cli = callPackage ../tools/networking/slack-cli { };