Signal-desktop emojis are broken

Hello,

I’m using signal-desktop with plasma5/xorg on nixos-unstable/x86_64 and since few weeks emojis aren’t displayed:

image

Are there any settings I should set?

Thanks in advance for your help,
Regards.

$ nixos-version                 
24.11.20241001.27e30d1 (Vicuna)
$ readlink $(which signal-desktop) 
/nix/store/0aiq9x50mmgv2ny6ic80pg07dgm4wjq0-signal-desktop-7.26.0/bin/signal-desktop
  services.xserver = {
    enable = true;
    videoDrivers = [ "modesetting" ];
    desktopManager.plasma5 = {
      enable = true;
      notoPackage = pkgs.noto-fonts-emoji;
    };
  };

  fonts = {
    # I've tried with and without, it has no visible effect
    packages = with pkgs; [
      nerdfonts
      # (nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; })
      # be enforced in the next realease
      noto-fonts
      noto-fonts-cjk
      noto-fonts-emoji
      noto-fonts-color-emoji
      noto-fonts-monochrome-emoji
      noto-fonts-emoji-blob-bin
      font-awesome
      source-han-sans
      # source-han-sans-japanese
      # source-han-serif-japanese
      (nerdfonts.override { fonts = [ "Meslo" ]; })
    ];
    fontconfig = {
      enable = true;
      defaultFonts = {
        monospace = [ "Meslo LG M Regular Nerd Font Complete Mono" ];
        serif = [ "Noto Serif" "Source Han Serif" ];
        sansSerif = [ "Noto Sans" "Source Han Sans" ];
      };
    };
  };

  environment.systemPackages = with pkgs; [ signal-desktop ];

Probably somehow caused by #337161, I can’t think of any other recent change that’s touched emojis.

Can you see if signal-desktop-apple-emoji from my PR or this overlay fixes your issue?

final: prev:

let
  self = prev.signal-desktop;
in
{
  # revert https://github.com/NixOS/nixpkgs/pull/337161
  signal-desktop = self.overrideAttrs (previousAttrs: {
    src = final.fetchurl {
      url = builtins.replaceStrings [ "7.25.0" ] [ "7.26.0" ]
        previousAttrs.src.url;
      hash = "sha256-FO9tkSW43qx3zzc+qUpCllsHxIKInE3gu1hMgXK7sxQ=";
    };

    nativeBuildInputs = previousAttrs.nativeBuildInputs ++ [ final.dpkg ];

    unpackPhase = ''
      runHook preUnpack

      dpkg-deb -x $src .

      runHook postUnpack
    '';

    installPhase =
      let
        lines = final.lib.splitString "\n" previousAttrs.installPhase;
        line =
          "# Copy the Noto Color Emoji PNGs into the ASAR contents. See `src`";
        index = final.lib.lists.findFirstIndex (x: x == line) null lines;
      in
      builtins.concatStringsSep "\n"
        ((final.lib.take index lines) ++ [ "runHook postInstall" ]);
  });
}

I does, thank you so much!

That’s quite unexpected, I didn’t think it’d actually be it. @emily apologies for the spam about this, but do you have any idea how the PR could have caused emojis not to show up (I don’t know the changes that well and I can’t think of anything plausible)? And selfishly, more evidence for merging my PR :wink:.

I have no idea what’s going on here, frankly. I know that a signal-desktop with the exact same derivation hash works for others. It should be displaying the same Noto emoji used in your fonts configuration. I don’t see how something like the desktop environment could affect it.

I’m trying to think of ways to debug this but drawing a blank. Do non‐reaction emojis display properly in messages?

Most of them are broken without @vazae patch.

When you say “most” – do the ones that do look like the black‐and‐white outlines from the original post? It’s very strange, because they should be pointing directly to the Noto PNGs that we inject into the app, and I haven’t seen anyone else with your specific issue.

Do PNG attachments work?

I’d say, it depends, basic emojis (derived from keystrokes, e.g. :), :(, :'() works in messages, not the others (e.g. :heart:).

Do you mean PNG files attaches to messages?

Yeah. The only hypothesis I can come up with is that somehow embedding PNGs isn’t working at all. Most of the alternatives are ruled out by the fact that the Signal package with the same hash works properly for others.

Do they show in colour?

Yes, they are yellow.

I am not sure if this is related, but I also had problems with black and white emojis some time ago. And the reason was that font lookup works different between Qt and GTK (as far as I remember). My current setup works for all apps (I thought it was working for all apps, but see below), maybe you find it interesting:

  fonts.packages = with pkgs; [
    # Core fonts.
    liberation_ttf
    dejavu_fonts

    # Mono space font with symbols and icons.
    (nerdfonts.override { fonts = [ "JetBrainsMono" ]; })

    # Emojis.
    noto-fonts-color-emoji

    # LaTeX.
    lmodern
  ];

  fonts.fontconfig.defaultFonts.emoji = [ "Noto Color Emoji" ];
  fonts.fontconfig.defaultFonts.monospace = [
    "JetBrainsMono Nerd Font"
    "Noto Color Emoji"
  ];
  fonts.fontconfig.defaultFonts.sansSerif = [
    "DejaVu Sans"
    "Noto Color Emoji"
  ];
  fonts.fontconfig.defaultFonts.serif = [
    "DejaVu Serif"
    "Noto Color Emoji"
  ];

I found it helpful to test emojis in the browser: For example: Full Emoji List, v16.0, or https://getemoji.com/.

The second page looks like so here:


(But when I copy the black and white emojis over to my Editor, or terminal they are nice and coloy :woozy_face:).

I’m extremely confused then. Would you be able to share more of your configuration?

I hope it’ll help:

hardware-configuration.nix:

{ config, lib, pkgs, modulesPath, ... }:

{
  imports =
    [ (modulesPath + "/installer/scan/not-detected.nix")
    ];

  boot = {
    initrd = {
      availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
    };
    extraModprobeConfig = ''
      options kvm_intel nested=1
    '';
    kernelModules = [ "kvm_intel" ];
    kernelParams = [ "intel_iommu=on" ];
  };

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/7ebee576-16ec-46a9-8eab-2fa4535adc93";
      fsType = "ext4";
    };

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/B511-17EF";
      fsType = "vfat";
    };

  swapDevices = [ ];

  powerManagement.cpuFreqGovernor = lib.mkDefault "performance";

  hardware.cpu.intel.updateMicrocode = true;

  hardware.intel-gpu-tools.enable = true;

  hardware.graphics = {
    enable = true;
    extraPackages = with pkgs; [
      intel-media-driver # LIBVA_DRIVER_NAME=iHD
      mesa.drivers # https://nixos.wiki/wiki/OpenGL#glxinfo
    ];
  };
  nixpkgs.config.packageOverrides = pkgs: {
    intel-vaapi-driver = pkgs.intel-vaapi-driver.override { enableHybridCodec = true; };
  };
}

configuration.nix:

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, lib, ... }:{
  nix = {
    settings = {
      trusted-public-keys = [
        "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
        "iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo="
        "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
        "mpickering.cachix.org-1:COxPsDJqqrggZgvKG6JeH9baHPue8/pcpYkmcBPUbeg="
      ];
      trusted-substituters = [
        "https://iohk.cachix.org"
        "https://nix-community.cachix.org"
        "https://mpickering.cachix.org"
        "https://nix-community.cachix.org"
      ];
      substituters = [
        "https://iohk.cachix.org"
        "https://nix-community.cachix.org"
        "https://mpickering.cachix.org"
        "https://nix-community.cachix.org/"
      ];
      trusted-users = [ "black" ];
      experimental-features = [ "nix-command" "flakes" ];
    };

    package = pkgs.nixVersions.stable;
  };

  nixpkgs.config = {
    allowUnfree = true;
    netbeans = false;
    permittedInsecurePackages = [
      "nodejs-16.20.1"
      # "NoiseTorch-0.11.5"
      "electron-25.9.0"
    ];
  };

  security = {
    rtkit.enable = true;
    wrappers = {
      "udevadm" = {
        setuid = true;
        setgid = true;
        owner = "root";
        group = "root";
        source = "${pkgs.systemd}/bin/udevadm";
      };
    };
  };

  imports = [
    # Include the results of the hardware scan.
    ./hardware-configuration.nix
  ];

  # Use the systemd-boot EFI boot loader.
  boot = {
    kernel.sysctl."fs.inotify.max_user_watches" = "1048576";
    loader = {
      efi.canTouchEfiVariables = true;
      systemd-boot.enable = true;
      timeout = 2;
    };
    plymouth.enable = false;
    tmp = {
      tmpfsSize = "110g";
      useTmpfs = true;
      cleanOnBoot = true;
    };
  };

  # Set your time zone.
  time.timeZone = "Europe/Paris";

  networking = {
    hostName = "looping";
    useDHCP = false;
    interfaces = {
      eno1.useDHCP = true;
    };


    firewall = {
      allowedTCPPorts = [ 80 443 ];
      trustedInterfaces = [ "docker0" ];
    };
  };

  i18n.defaultLocale = "en_US.UTF-8";
  console = {
    keyMap = "fr";
    font = "ter-i32b";
    packages = with pkgs; [ terminus_font ];
  };

  # X11
  services.xserver = {
    enable = true;
    videoDrivers = [ "modesetting" ];
    desktopManager.plasma5 = {
      enable = true;
      notoPackage = pkgs.noto-fonts-emoji;
    };
    xkb = {
      layout = "fr";
      options = "eurosign:e";
    };
  };
  services.displayManager = {
    sddm = {
      enable = true;
      autoNumlock = true;
    };
    defaultSession = "plasma";
    autoLogin = {
      enable = true;
      user = "black";
    };
  };
  fonts = {
    # This is depricated new sytax will
    packages = with pkgs; [
      nerdfonts
      # (nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; })
      # be enforced in the next realease
      noto-fonts
      noto-fonts-cjk
      noto-fonts-emoji
      noto-fonts-color-emoji
      noto-fonts-monochrome-emoji
      noto-fonts-emoji-blob-bin
      font-awesome
      source-han-sans
      # source-han-sans-japanese
      # source-han-serif-japanese
      (nerdfonts.override { fonts = [ "Meslo" ]; })
    ];
    fontconfig = {
      enable = true;
      defaultFonts = {
        monospace = [ "Meslo LG M Regular Nerd Font Complete Mono" ];
        serif = [ "Noto Serif" "Source Han Serif" ];
        sansSerif = [ "Noto Sans" "Source Han Sans" ];
      };
    };
  };

  services.avahi = {
    enable = true;
    nssmdns4 = true;
  };

  virtualisation.docker = {
    enable = true;
  };


  hardware.pulseaudio.enable = false;

  services.pipewire = {
    enable = true;
    audio.enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
  };

  users = {
    users.black = {
      isNormalUser = true;
      extraGroups =
        [ "docker" "wheel" "sudo" "scanner" "lp" "audio" "libvirtd" ];
      shell = pkgs.zsh;
    };
    extraGroups.vboxusers.members = [ "black" ];
  };

  home-manager.users.black = hm@{ ... }: {
    home.username = "black";
    home.homeDirectory = "/home/black";
    home.stateVersion = "23.05";
    programs.home-manager.enable = true;
    services = {
      activitywatch = { enable = true; };
      espanso = {
        enable = true;
        matches = {};
        configs = {
          default = {
            search_shortcut = "ALT+SHIFT+SPACE";
            keyboard_layout.layout = "fr";
          };
        };
      };
    };
  };

  nixpkgs.config.packageOverrides = pkgs: {
    vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
    haskellPackages = pkgs.haskellPackages.override {
      overrides = self: super:
        let
          jailbreakUnbreak = pkg:
            with pkgs.haskell.lib;
            unmarkBroken (dontCheck (doJailbreak pkg));
        in { dhall-lsp-server = jailbreakUnbreak super.dhall-lsp-server; };
    };
  };

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    appflowy
    ark
    bat
    cacert
    cachix
    chromium
    clang
    cmake
    comma
    curlie
    devenv
    dhall
    dhall-lsp-server
    difftastic
    discord
    dive
    docker
    element-desktop
    entr
    envsubst
    fd
    ffmpeg
    file
    fzf
    git
    gnumake
    google-chrome
    graphite-cli
    gwenview
    haskell-language-server
    haskellPackages.hoogle.out.out
    hlint
    haskellPackages.apply-refact.out
    haskellPackages.hscolour.out
    imagemagick
    inotify-tools
    jq
    kate
    keybase-gui
    killall
    konversation
    kolourpaint
    libnotify
    libsForQt5.qt5.qttools
    libreoffice
    libva # Intel Graphics accelerator
    libva-utils # Intel Graphics accelerator
    ltex-ls
    lua-language-server
    nfs-utils
    nixfmt-classic
    nixpkgs-fmt
    nmap
    nodejs
    nodePackages.npm
    nil # Nix lsp
    nix-output-monitor
    neovim
    haskellPackages.ormolu.out
    okular
    openpomodoro-cli
    libsForQt5.plasma-pa
    haskellPackages.pretty-show.out
    pry
    python311Full
    python311Packages.pip
    python311Packages.pyaml
    python311Packages.setuptools
    rbenv
    ripgrep
    rnnoise
    rsync
    ruby_3_1
    sddm-kcm
    shellcheck
    slack
    sqlite
    streamcontroller
    rubyPackages_3_1.solargraph
    sops
    sox
    starship
    haskellPackages.stack.out
    signal-desktop
    thunderbird
    tmux
    tree
    unzip
    update-systemd-resolved
    vivid
    vlc
    vscode-langservers-extracted
    wget
    yaml-language-server
    yt-dlp
    yq
    zlib
    zip
    zsh
  ];

  environment.interactiveShellInit = ''
    source ${pkgs.fzf-git-sh}/share/fzf-git-sh/fzf-git.sh
  '';

  programs = {
    _1password-gui = {
      enable = true;
      polkitPolicyOwners = [ "user" ];
    };
    chromium = {
      enable = true;
      extraOpts = { "DefaultBrowserSettingEnabled" = false; };
      enablePlasmaBrowserIntegration = true;
    };
    direnv = {
      enable = true;
      nix-direnv.enable = true;
    };
    dconf.enable = true;
    firefox.enable = true;
    fzf = {
      keybindings = true;
      fuzzyCompletion = true;
    };
    gnupg.agent = {
      enable = true;
      enableSSHSupport = true;
    };
    git.enable = true;
    kdeconnect.enable = true;
    neovim = {
      enable = true;
      defaultEditor = true;
      viAlias = true;
      vimAlias = true;
    };
    nix-index = {
      enableBashIntegration = false;
      enableZshIntegration = true;
    };
    tmux.enable = true;
    zsh.enable = true;
  };


  services.keybase.enable = true;
  services.openssh.enable = true;

  services.devmon.enable = true;
  services.gvfs.enable = true;
  services.udisks2.enable = true;

  services.rpcbind.enable = true;
  system.stateVersion = "23.11";

}