nixpkgs-suyu/pkgs/applications/networking/instant-messengers/signal-desktop/default.nix

121 lines
3.8 KiB
Nix
Raw Normal View History

{ stdenv, lib, fetchurl, dpkg, wrapGAppsHook
2019-05-22 13:03:39 +02:00
, gnome2, gtk3, atk, at-spi2-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, libnotify, libuuid, at-spi2-core, libappindicator-gtk3
# Unfortunately this also overwrites the UI language (not just the spell
# checking language!):
, hunspellDicts, spellcheckerLanguage ? null # E.g. "de_DE"
# For a full list of available languages:
# $ cat pkgs/development/libraries/hunspell/dictionaries.nix | grep "dictFileName =" | awk '{ print $3 }'
}:
let
customLanguageWrapperArgs = (with lib;
let
# E.g. "de_DE" -> "de-de" (spellcheckerLanguage -> hunspellDict)
spellLangComponents = splitString "_" spellcheckerLanguage;
hunspellDict = elemAt spellLangComponents 0 + "-" + toLower (elemAt spellLangComponents 1);
in if spellcheckerLanguage != null
then ''
--set HUNSPELL_DICTIONARIES "${hunspellDicts.${hunspellDict}}/share/hunspell" \
--set LC_MESSAGES "${spellcheckerLanguage}"''
else "");
rpath = lib.makeLibraryPath [
alsaLib
atk
at-spi2-atk
at-spi2-core
cairo
cups
dbus
expat
fontconfig
freetype
2019-05-22 13:03:39 +02:00
gdk-pixbuf
glib
2018-07-10 00:34:32 +02:00
gnome2.GConf
2018-06-01 02:50:37 +02:00
gtk3
pango
libappindicator-gtk3
2018-09-25 14:28:14 +02:00
libnotify
2019-03-22 01:24:39 +01:00
libuuid
libX11
libXScrnSaver
libXcomposite
libXcursor
libXdamage
libXext
libXfixes
libXi
libXrandr
libXrender
libXtst
nspr
nss
udev
2018-03-13 11:16:03 +01:00
xorg.libxcb
];
in stdenv.mkDerivation rec {
pname = "signal-desktop";
2019-10-11 12:49:30 +02:00
version = "1.27.4"; # Please backport all updates to the stable channel.
# All releases have a limited lifetime and "expire" 90 days after the release.
# When releases "expire" the application becomes unusable until an update is
# applied. The expiration date for the current release can be extracted with:
# $ grep -a "^{\"buildExpiration" "${signal-desktop}/libexec/resources/app.asar"
# (Alternatively we could try to patch the asar archive, but that requires a
# few additional steps and might not be the best idea.)
src = fetchurl {
url = "https://updates.signal.org/desktop/apt/pool/main/s/signal-desktop/signal-desktop_${version}_amd64.deb";
2019-10-11 12:49:30 +02:00
sha256 = "1aza1s70xzx9qkv7b5mpfi4zgdn5dq3rl03lx3jixij3x3pxg5sj";
};
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}/" \
--prefix LD_LIBRARY_PATH : "${stdenv.cc.cc.lib}/lib" \
${customLanguageWrapperArgs} \
"''${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 = "Private, simple, and secure messenger";
longDescription = ''
Signal Desktop is an Electron application that links with your
"Signal Android" or "Signal iOS" app.
'';
homepage = https://signal.org/;
license = lib.licenses.gpl3;
maintainers = with lib.maintainers; [ ixmatus primeos ];
platforms = [ "x86_64-linux" ];
};
}