2020-04-28 12:59:05 +01:00
|
|
|
{ stdenv, lib, fetchurl, autoPatchelfHook, dpkg, wrapGAppsHook, nixosTests
|
2019-05-22 12:03:39 +01:00
|
|
|
, gnome2, gtk3, atk, at-spi2-atk, cairo, pango, gdk-pixbuf, glib, freetype, fontconfig
|
2018-06-01 13:53:30 +01:00
|
|
|
, dbus, libX11, xorg, libXi, libXcursor, libXdamage, libXrandr, libXcomposite
|
2021-06-10 03:57:09 +01:00
|
|
|
, libXext, libXfixes, libXrender, libXtst, libXScrnSaver, nss, nspr, alsa-lib
|
2021-04-09 09:50:31 +01:00
|
|
|
, cups, expat, libuuid, at-spi2-core, libappindicator-gtk3, mesa
|
2020-08-23 20:46:37 +01:00
|
|
|
# Runtime dependencies:
|
2020-09-16 22:52:22 +01:00
|
|
|
, systemd, libnotify, libdbusmenu, libpulseaudio
|
2018-08-04 15:01:44 +01:00
|
|
|
# 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 }'
|
2017-11-07 12:26:45 +00:00
|
|
|
}:
|
2018-06-01 13:53:30 +01:00
|
|
|
|
2017-11-07 12:26:45 +00:00
|
|
|
let
|
2018-08-04 15:01:44 +01:00
|
|
|
customLanguageWrapperArgs = (with lib;
|
|
|
|
let
|
|
|
|
# E.g. "de_DE" -> "de-de" (spellcheckerLanguage -> hunspellDict)
|
|
|
|
spellLangComponents = splitString "_" spellcheckerLanguage;
|
|
|
|
hunspellDict = elemAt spellLangComponents 0 + "-" + toLower (elemAt spellLangComponents 1);
|
2021-10-06 18:18:20 +01:00
|
|
|
in lib.optionalString (spellcheckerLanguage != null) ''
|
|
|
|
--set HUNSPELL_DICTIONARIES "${hunspellDicts.${hunspellDict}}/share/hunspell" \
|
|
|
|
--set LC_MESSAGES "${spellcheckerLanguage}"'');
|
2020-01-17 21:51:06 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "signal-desktop";
|
2021-10-16 21:30:08 +01:00
|
|
|
version = "5.20.0"; # Please backport all updates to the stable channel.
|
2020-01-17 21:51:06 +00:00
|
|
|
# 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}/lib/Signal/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";
|
2021-10-16 21:30:08 +01:00
|
|
|
sha256 = "0a57gajxjqkp7zcmjc3iiys06b7v53nd81gkwrsfn2gmshihlzkd";
|
2020-01-17 21:51:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
autoPatchelfHook
|
|
|
|
dpkg
|
|
|
|
wrapGAppsHook
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2021-06-10 03:57:09 +01:00
|
|
|
alsa-lib
|
2018-11-27 19:03:36 +00:00
|
|
|
at-spi2-atk
|
2019-09-05 22:49:47 +01:00
|
|
|
at-spi2-core
|
2020-01-17 21:51:06 +00:00
|
|
|
atk
|
2017-11-07 12:26:45 +00:00
|
|
|
cairo
|
|
|
|
cups
|
|
|
|
dbus
|
|
|
|
expat
|
|
|
|
fontconfig
|
|
|
|
freetype
|
2019-05-22 12:03:39 +01:00
|
|
|
gdk-pixbuf
|
2017-11-07 12:26:45 +00:00
|
|
|
glib
|
2018-07-09 23:34:32 +01:00
|
|
|
gnome2.GConf
|
2018-06-01 01:50:37 +01:00
|
|
|
gtk3
|
2017-11-07 12:26:45 +00:00
|
|
|
libX11
|
|
|
|
libXScrnSaver
|
|
|
|
libXcomposite
|
|
|
|
libXcursor
|
|
|
|
libXdamage
|
|
|
|
libXext
|
|
|
|
libXfixes
|
|
|
|
libXi
|
|
|
|
libXrandr
|
|
|
|
libXrender
|
|
|
|
libXtst
|
2020-01-17 21:51:06 +00:00
|
|
|
libappindicator-gtk3
|
|
|
|
libnotify
|
|
|
|
libuuid
|
2021-04-09 09:50:31 +01:00
|
|
|
mesa # for libgbm
|
2017-11-07 12:26:45 +00:00
|
|
|
nspr
|
|
|
|
nss
|
2020-01-17 21:51:06 +00:00
|
|
|
pango
|
|
|
|
systemd
|
2018-03-13 10:16:03 +00:00
|
|
|
xorg.libxcb
|
2021-05-12 18:38:31 +01:00
|
|
|
xorg.libxshmfence
|
2017-11-07 12:26:45 +00:00
|
|
|
];
|
|
|
|
|
2020-01-17 21:51:06 +00:00
|
|
|
runtimeDependencies = [
|
2020-08-12 19:13:30 +01:00
|
|
|
(lib.getLib systemd)
|
2020-02-12 22:31:31 +00:00
|
|
|
libnotify
|
2020-08-23 20:46:37 +01:00
|
|
|
libdbusmenu
|
2020-01-17 21:51:06 +00:00
|
|
|
];
|
2017-11-07 12:26:45 +00:00
|
|
|
|
2018-06-01 13:53:30 +01:00
|
|
|
unpackPhase = "dpkg-deb -x $src .";
|
2017-11-07 12:26:45 +00:00
|
|
|
|
2020-01-17 21:51:06 +00:00
|
|
|
dontBuild = true;
|
|
|
|
dontConfigure = true;
|
|
|
|
dontPatchELF = true;
|
2020-01-24 12:21:04 +00:00
|
|
|
# We need to run autoPatchelf manually with the "no-recurse" option, see
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/78413 for the reasons.
|
|
|
|
dontAutoPatchelf = true;
|
2017-11-07 12:26:45 +00:00
|
|
|
|
2020-01-17 21:51:06 +00:00
|
|
|
installPhase = ''
|
2021-04-13 12:42:44 +01:00
|
|
|
runHook preInstall
|
|
|
|
|
2020-01-17 21:51:06 +00:00
|
|
|
mkdir -p $out/lib
|
2017-11-07 12:26:45 +00:00
|
|
|
|
2020-01-17 21:51:06 +00:00
|
|
|
mv usr/share $out/share
|
2020-01-24 12:21:04 +00:00
|
|
|
mv opt/Signal $out/lib/Signal
|
|
|
|
|
|
|
|
# Note: The following path contains bundled libraries:
|
|
|
|
# $out/lib/Signal/resources/app.asar.unpacked/node_modules/sharp/vendor/lib/
|
|
|
|
# We run autoPatchelf with the "no-recurse" option to avoid picking those
|
|
|
|
# up, but resources/app.asar still requires them.
|
2018-06-01 13:53:30 +01:00
|
|
|
|
|
|
|
# Symlink to bin
|
|
|
|
mkdir -p $out/bin
|
2021-08-16 12:02:11 +01:00
|
|
|
ln -s $out/lib/Signal/signal-desktop $out/bin/signal-desktop
|
2021-04-13 12:42:44 +01:00
|
|
|
|
|
|
|
runHook postInstall
|
2020-01-17 21:51:06 +00:00
|
|
|
'';
|
|
|
|
|
2021-05-14 01:23:56 +01:00
|
|
|
# Required for $SQLCIPHER_LIB which contains "/build/" inside the path:
|
|
|
|
noAuditTmpdir = true;
|
|
|
|
|
2020-01-17 21:51:06 +00:00
|
|
|
preFixup = ''
|
2021-05-14 01:23:56 +01:00
|
|
|
export SQLCIPHER_LIB="$out/lib/Signal/resources/app.asar.unpacked/node_modules/better-sqlite3/build/Release/better_sqlite3.node"
|
|
|
|
test -x "$SQLCIPHER_LIB" # To ensure the location hasn't changed
|
2020-01-17 21:51:06 +00:00
|
|
|
gappsWrapperArgs+=(
|
2021-01-15 05:42:41 +00:00
|
|
|
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc ] }"
|
2021-05-14 01:23:56 +01:00
|
|
|
--prefix LD_PRELOAD : "$SQLCIPHER_LIB"
|
2020-01-17 21:51:06 +00:00
|
|
|
${customLanguageWrapperArgs}
|
|
|
|
)
|
2017-11-07 12:26:45 +00:00
|
|
|
|
2018-06-01 13:53:30 +01:00
|
|
|
# Fix the desktop link
|
|
|
|
substituteInPlace $out/share/applications/signal-desktop.desktop \
|
|
|
|
--replace /opt/Signal/signal-desktop $out/bin/signal-desktop
|
2020-01-24 12:21:04 +00:00
|
|
|
|
|
|
|
autoPatchelf --no-recurse -- $out/lib/Signal/
|
2021-05-26 14:09:14 +01:00
|
|
|
patchelf --add-needed ${libpulseaudio}/lib/libpulse.so $out/lib/Signal/resources/app.asar.unpacked/node_modules/ringrtc/build/linux/libringrtc-x64.node
|
2018-06-01 13:53:30 +01:00
|
|
|
'';
|
|
|
|
|
2020-04-28 12:59:05 +01:00
|
|
|
# Tests if the application launches and waits for "Link your phone to Signal Desktop":
|
|
|
|
passthru.tests.application-launch = nixosTests.signal-desktop;
|
|
|
|
|
2018-06-01 13:53:30 +01:00
|
|
|
meta = {
|
|
|
|
description = "Private, simple, and secure messenger";
|
|
|
|
longDescription = ''
|
|
|
|
Signal Desktop is an Electron application that links with your
|
|
|
|
"Signal Android" or "Signal iOS" app.
|
|
|
|
'';
|
2020-03-05 10:57:38 +00:00
|
|
|
homepage = "https://signal.org/";
|
|
|
|
changelog = "https://github.com/signalapp/Signal-Desktop/releases/tag/v${version}";
|
2021-04-13 12:42:44 +01:00
|
|
|
license = lib.licenses.agpl3Only;
|
2019-11-14 22:22:39 +00:00
|
|
|
maintainers = with lib.maintainers; [ ixmatus primeos equirosa ];
|
2018-06-01 13:53:30 +01:00
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
};
|
|
|
|
}
|