3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/networking/instant-messengers/signal-desktop/default.nix
Michael Weiss 5d795355a0 signal-desktop: Fix a possible crash when saving an attachment
If executed in a pure environment (nix-shell --pure) or depending on the
`gtk3` version of the system Signal-Desktop was e.g. crashing when
clicking on a PDF attachment (instead of showing the dialog to save a
file).
Using wrapGAppsHook and setting XDG_DATA_DIRS to the correct version
fixes this bug.

The error message was the following:
```
(signal-desktop:30756): Gtk-WARNING **: 14:04:49.073: Could not find the icon 'user-home-symbolic-ltr'. The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
        http://icon-theme.freedesktop.org/releases

(signal-desktop:30756): GLib-GIO-ERROR **: 14:04:49.134: No GSettings schemas are installed on the system
Trace/breakpoint trap
```
2018-06-01 14:32:26 +02:00

93 lines
2.3 KiB
Nix

{ stdenv, lib, fetchurl, dpkg, wrapGAppsHook, gnome3, gtk3, atk, cairo, pango, gdk_pixbuf, glib, freetype,
fontconfig, dbus, libX11, xorg, libXi, libXcursor, libXdamage, libXrandr,
libXcomposite, libXext, libXfixes, libXrender, libXtst, libXScrnSaver, nss,
nspr, alsaLib, cups, expat, udev
}:
let
rpath = lib.makeLibraryPath [
alsaLib
atk
cairo
cups
dbus
expat
fontconfig
freetype
gdk_pixbuf
glib
gnome3.gconf
gtk3
pango
libX11
libXScrnSaver
libXcomposite
libXcursor
libXdamage
libXext
libXfixes
libXi
libXrandr
libXrender
libXtst
nspr
nss
stdenv.cc.cc
udev
xorg.libxcb
];
in
stdenv.mkDerivation rec {
name = "signal-desktop-${version}";
version = "1.12.0";
src =
if stdenv.system == "x86_64-linux" then
fetchurl {
url = "https://updates.signal.org/desktop/apt/pool/main/s/signal-desktop/signal-desktop_${version}_amd64.deb";
sha256 = "19c9pilx2qkpyqw3p167bfcizrpd4np5jxdcwqmpbcfibmrpmcsk";
}
else
throw "Signal for Desktop is not currently supported on ${stdenv.system}";
phases = [ "unpackPhase" "installPhase" ];
nativeBuildInputs = [ dpkg wrapGAppsHook ];
unpackPhase = "dpkg-deb -x $src .";
installPhase = ''
mkdir -p $out
cp -R opt $out
mv ./usr/share $out/share
mv $out/opt/Signal $out/libexec
rmdir $out/opt
chmod -R g-w $out
# Patch signal
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath ${rpath}:$out/libexec $out/libexec/signal-desktop
wrapProgram $out/libexec/signal-desktop \
--prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \
"''${gappsWrapperArgs[@]}"
# Symlink to bin
mkdir -p $out/bin
ln -s $out/libexec/signal-desktop $out/bin/signal-desktop
# Fix the desktop link
substituteInPlace $out/share/applications/signal-desktop.desktop \
--replace /opt/Signal/signal-desktop $out/bin/signal-desktop
'';
meta = {
description = "Signal Private Messenger for the Desktop.";
homepage = https://signal.org/;
license = lib.licenses.gpl3;
maintainers = with lib.maintainers; [ ixmatus primeos ];
platforms = [
"x86_64-linux"
];
};
}