Commit 81ce4062 authored by Gliczy's avatar Gliczy
Browse files

signal-desktop-bin: replace apple emoji sheets

Signal now ships with `emoji-sheet-32.webp` and `emoji-sheet-64.webp`, both use Apple emoji.
This commit removes both and replace them with the equivalent noto-fonts emoji sheets.
parent a4b9dd0a
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@
  at-spi2-core,
  libappindicator-gtk3,
  libgbm,
  libwebp,
  # Runtime dependencies:
  systemd,
  libnotify,
@@ -86,6 +87,15 @@ let
      runHook postInstall
    '';
  });

  noto-emoji-sheet-32 = fetchurl {
    url = "https://raw.githubusercontent.com/iamcal/emoji-data/refs/tags/v15.1.2/sheet_google_32.png";
    hash = "sha256-S03NCTbvB5yeQl62WpLNjNGhjNErtgaOB6tAj/X8vPc=";
  };
  noto-emoji-sheet-64 = fetchurl {
    url = "https://raw.githubusercontent.com/iamcal/emoji-data/refs/tags/v15.1.2/sheet_google_64.png";
    hash = "sha256-kZYStR5xAuausSpOD6wJZRJZ1K6nPpweE3aYSgWntS4=";
  };
in
stdenv.mkDerivation rec {
  inherit pname version;
@@ -124,7 +134,8 @@ stdenv.mkDerivation rec {
      asar extract "$out/${libdir}/resources/app.asar" $out/asar-contents
      rm -r \
        "$out/${libdir}/resources/app.asar"{,.unpacked} \
        $out/asar-contents/node_modules/emoji-datasource-apple
        $out/asar-contents/images/emoji-sheet-32.webp \
        $out/asar-contents/images/emoji-sheet-64.webp
    '';
  };

@@ -136,6 +147,7 @@ stdenv.mkDerivation rec {
    # override doesn't preserve splicing https://github.com/NixOS/nixpkgs/issues/132651
    # 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.
    (buildPackages.wrapGAppsHook3.override { makeWrapper = buildPackages.makeShellWrapper; })
    libwebp
  ];

  buildInputs = [
@@ -208,6 +220,10 @@ stdenv.mkDerivation rec {
    # Create required symlinks:
    ln -s libGLESv2.so "$out/lib/signal-desktop/libGLESv2.so.2"

    # Compress the emoji sheets to webp, as signal expects webp images. The flags used are the same as those used upstream.
    cwebp -progress -mt -preset icon -alpha_filter best -alpha_q 20 -pass 10 -q 75 ${noto-emoji-sheet-32} -o asar-contents/images/emoji-sheet-32.webp
    cwebp -progress -mt -preset icon -alpha_filter best -alpha_q 20 -pass 10 -q 75 ${noto-emoji-sheet-64} -o asar-contents/images/emoji-sheet-64.webp

    # Copy the Noto Color Emoji PNGs into the ASAR contents. See `src`
    # for the motivation, and the script for the technical details.
    emojiPrefix=$(
@@ -270,6 +286,9 @@ stdenv.mkDerivation rec {

      # Various npm packages
      lib.licenses.free

      lib.licenses.asl20 # noto-emoji
      lib.licenses.mit # emoji-data
    ];
    maintainers = with lib.maintainers; [
      mic92