6 , noto-fonts-color-emoji
43 , libappindicator-gtk3
45 # Runtime dependencies:
62 inherit (stdenv) targetPlatform;
63 ARCH = if targetPlatform.isAarch64 then "arm64" else "x64";
65 # Noto Color Emoji PNG files for emoji replacement; see below.
66 noto-fonts-color-emoji-png = noto-fonts-color-emoji.overrideAttrs (prevAttrs: {
67 pname = "noto-fonts-color-emoji-png";
69 # The build produces 136×128 PNGs by default for arcane font
70 # reasons, but we want square PNGs.
71 buildFlags = prevAttrs.buildFlags or [ ] ++ [ "BODY_DIMENSIONS=128x128" ];
73 makeTargets = [ "compressed" ];
79 mv build/compressed_pngs $out/share/noto-fonts-color-emoji-png
80 python3 add_aliases.py --srcdir=$out/share/noto-fonts-color-emoji-png
86 stdenv.mkDerivation rec {
87 inherit pname version;
89 # Please backport all updates to the stable channel.
90 # All releases have a limited lifetime and "expire" 90 days after the release.
91 # When releases "expire" the application becomes unusable until an update is
92 # applied. The expiration date for the current release can be extracted with:
93 # $ grep -a "^{\"buildExpiration" "${signal-desktop}/lib/${dir}/resources/app.asar"
94 # (Alternatively we could try to patch the asar archive, but that requires a
95 # few additional steps and might not be the best idea.)
100 downloadToTemp = true;
101 nativeBuildInputs = [ dpkg asar ];
102 # Signal ships the Apple emoji set without a licence via an npm
103 # package and upstream does not seem terribly interested in fixing
106 # * <https://github.com/signalapp/Signal-Android/issues/5862>
107 # * <https://whispersystems.discoursehosting.net/t/signal-is-likely-violating-apple-license-terms-by-using-apple-emoji-in-the-sticker-creator-and-android-and-desktop-apps/52883>
109 # We work around this by replacing it with the Noto Color Emoji
110 # set, which is available under a FOSS licence and more likely to
111 # be used on a NixOS machine anyway. The Apple emoji are removed
112 # during `fetchurl` to ensure that the build doesn’t cache the
113 # unlicensed emoji files, but the rest of the work is done in the
116 dpkg-deb -x $downloadedFile $out
117 asar extract "$out/opt/${dir}/resources/app.asar" $out/asar-contents
119 "$out/opt/${dir}/resources/app.asar"{,.unpacked} \
120 $out/asar-contents/node_modules/emoji-datasource-apple
124 nativeBuildInputs = [
129 # override doesn't preserve splicing https://github.com/NixOS/nixpkgs/issues/132651
130 # Has to use `makeShellWrapper` from `buildPackages` even though `makeShellWrapper` from the inputs is spliced because `propagatedBuildInputs` would pick the wrong one because of a different offset.
131 (buildPackages.wrapGAppsHook3.override { makeWrapper = buildPackages.makeShellWrapper; })
172 runtimeDependencies = [
183 dontConfigure = true;
186 rsync -a --chmod=+w $src/ .
194 mv usr/share $out/share
195 mv "opt/${dir}" "$out/lib/${dir}"
199 ln -s "$out/lib/${dir}/${pname}" $out/bin/${pname}
201 # Create required symlinks:
202 ln -s libGLESv2.so "$out/lib/${dir}/libGLESv2.so.2"
204 # Copy the Noto Color Emoji PNGs into the ASAR contents. See `src`
205 # for the motivation, and the script for the technical details.
207 python3 ${./copy-noto-emoji.py} \
208 ${noto-fonts-color-emoji-png}/share/noto-fonts-color-emoji-png \
212 # Replace the URL used for fetching large versions of emoji with
213 # the local path to our copied PNGs.
214 substituteInPlace asar-contents/preload.bundle.js \
216 'emoji://jumbo?emoji=' \
217 "file://$out/lib/${lib.escapeURL dir}/resources/app.asar/$emojiPrefix/"
219 # `asar(1)` copies files from the corresponding `.unpacked`
220 # directory when extracting, and will put them back in the modified
221 # archive if you don’t specify them again when repacking. Signal
222 # leaves their native `.node` libraries unpacked, so we match that.
226 "$out/lib/${dir}/resources/app.asar"
233 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
234 --suffix PATH : ${lib.makeBinPath [ xdg-utils ]}
237 # Fix the desktop link
238 substituteInPlace $out/share/applications/${pname}.desktop \
239 --replace-fail "/opt/${dir}/${pname}" $out/bin/${pname} \
240 --replace-fail "StartupWMClass=Signal" "StartupWMClass=signal"
242 # Note: The following path contains bundled libraries:
243 # $out/lib/${dir}/resources/app.asar.unpacked/node_modules/
244 patchelf --add-needed ${libpulseaudio}/lib/libpulse.so "$out/lib/${dir}/resources/app.asar.unpacked/node_modules/@signalapp/ringrtc/build/linux/libringrtc-${ARCH}.node"
248 # Tests if the application launches and waits for "Link your phone to Signal Desktop":
249 tests.application-launch = nixosTests.signal-desktop;
250 updateScript.command = [ ./update.sh ];
254 description = "Private, simple, and secure messenger";
256 Signal Desktop is an Electron application that links with your
257 "Signal Android" or "Signal iOS" app.
259 homepage = "https://signal.org/";
260 changelog = "https://github.com/signalapp/Signal-Desktop/releases/tag/v${version}";
262 lib.licenses.agpl3Only
264 # Various npm packages
267 maintainers = with lib.maintainers; [
276 platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
277 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];