slack: 4.2.0 -> 4.4.0

* 4.4.1 on Darwin
* remove dark-theme, it's now included in the release
This commit is contained in:
Pavol Rusnak 2020-03-26 23:13:14 +01:00
parent 38aa1cad7f
commit 84d18ac49f
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
3 changed files with 56 additions and 84 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,
cups, curl, dbus, expat, fontconfig, freetype, glib , gnome2, gtk3, gdk-pixbuf,
libappindicator-gtk3, libnotify, libxcb, nspr, nss, pango , systemd, xorg,
at-spi2-atk, at-spi2-core, libuuid, nodePackages, libpulseaudio, xdg_utils
{ stdenv
, fetchurl
, dpkg
, 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
version = "4.2.0";
pname = "slack";
inherit (stdenv.hostPlatform) system;
throwSystem = throw "Unsupported system: ${system}";
pname = "slack";
sha256 = {
x86_64-darwin = "0947a98m7yz4hldjvcqnv9s17dpvlsk9sflc1zc99hf500zck0w1";
x86_64-linux = "01b2klhky04fijdqcpfafgdqx2c5nh2fpnzvzgvz10hv7h16cinv";
x86_64-darwin = "05xsbiviikrwfayjr6rvvfkm70681x2an6mgcg1cxw1fsi4sr6fd";
x86_64-linux = "0h2rfgx92yq9a6dqsv9a0r8a6m5xfrywkljjk5w9snw49b0r1p12";
}.${system} or throwSystem;
meta = with stdenv.lib; {
description = "Desktop client for Slack";
homepage = https://slack.com;
license = licenses.unfree;
maintainers = [ maintainers.mmahut ];
maintainers = with maintainers; [ mmahut ];
platforms = [ "x86_64-darwin" "x86_64-linux" ];
};
linux = stdenv.mkDerivation rec {
inherit pname version meta;
inherit pname meta;
version = "4.4.0";
src = fetchurl {
url = "https://downloads.slack-edge.com/linux_releases/slack-desktop-${version}-amd64.deb";
inherit sha256;
@ -47,23 +72,22 @@ let
expat
fontconfig
freetype
gdk-pixbuf
glib
gnome2.GConf
gdk-pixbuf
gtk3
pango
libnotify
libxcb
libappindicator-gtk3
libnotify
libpulseaudio
libuuid
libxcb
nspr
nss
pango
stdenv.cc.cc
systemd
libuuid
libpulseaudio
xorg.libxkbfile
xorg.libX11
xorg.libXScrnSaver
xorg.libXcomposite
xorg.libXcursor
xorg.libXdamage
@ -73,65 +97,51 @@ let
xorg.libXrandr
xorg.libXrender
xorg.libXtst
xorg.libXScrnSaver
xorg.libxkbfile
] + ":${stdenv.cc.cc.lib}/lib64";
buildInputs = [
gtk3 # needed for GSETTINGS_SCHEMAS_PATH
];
nativeBuildInputs = [ dpkg makeWrapper nodePackages.asar ];
dontUnpack = true;
dontBuild = true;
dontPatchELF = true;
installPhase = ''
# The deb file contains a setuid binary, so 'dpkg -x' doesn't work here
dpkg --fsys-tarfile $src | tar --extract
rm -rf usr/share/lintian
mkdir -p $out
mv usr/* $out
# Otherwise it looks "suspicious"
chmod -R g-w $out
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-rpath ${rpath}:$out/lib/slack $file || true
done
# Replace the broken bin/slack symlink with a startup wrapper
rm $out/bin/slack
makeWrapper $out/lib/slack/slack $out/bin/slack \
--prefix XDG_DATA_DIRS : $GSETTINGS_SCHEMAS_PATH \
--prefix PATH : ${xdg_utils}/bin
# Fix the desktop link
substituteInPlace $out/share/applications/slack.desktop \
--replace /usr/bin/ $out/bin/ \
--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 {
inherit pname version meta;
darwin = stdenv.mkDerivation rec {
inherit pname meta;
version = "4.4.1";
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