signal-desktop-bin: drop

This commit is contained in:
Gliczy
2026-03-02 16:46:54 +01:00
parent 7b25dc29ae
commit 6ec1a9d747
9 changed files with 1 additions and 535 deletions
@@ -1,70 +0,0 @@
"""Copy Noto Color Emoji PNGs into an extracted Signal ASAR archive.
Signal loads small Apple emoji PNGs directly from
`node_modules/emoji-datasource-apple/img/apple/64`, and downloads and
caches large Apple emoji WebP files in `.proto` bundles on the fly. The
latter are not a copyright concern for the Nixpkgs cache, but would
result in inconsistent presentation between small and large emoji.
We skip the complexity and buy some additional privacy by replacing the
`emoji://jumbo?emoji=` URL prefix with a `file://` path to the copied
PNGs inside the ASAR archive, and linking the `node_modules` PNG paths
directly to them.
"""
import json
import shutil
import sys
from pathlib import Path
def emoji_to_noto_name(emoji: str) -> str:
r"""Return the Noto emoji name of an emoji.
Noto emoji names are underscoreseparated Unicode scalar values,
represented in lowercase bigendian hex padded to at least four
digits. Any U+FE0F variant selectors are omitted.
>>> emoji_to_noto_name("😶‍🌫️")
'1f636_200d_1f32b'
>>> emoji_to_noto_name("\U0001f636\u200d\U0001f32b\ufe0f")
'1f636_200d_1f32b'
"""
return "_".join(
f"{ord(scalar_value):04x}"
for scalar_value in emoji
if scalar_value != "\ufe0f"
)
def _main() -> None:
noto_png_path, asar_root = (Path(arg) for arg in sys.argv[1:])
asar_root = asar_root.absolute()
out_path = asar_root / "images" / "nixpkgs-emoji"
out_path.mkdir(parents=True)
jumbomoji_json_path = asar_root / "build" / "jumbomoji.json"
with jumbomoji_json_path.open() as jumbomoji_json_file:
jumbomoji_packs = json.load(jumbomoji_json_file)
for signal_emoji_names in jumbomoji_packs.values():
for signal_emoji_name in signal_emoji_names:
try:
shutil.copy(
noto_png_path / f"emoji_u{emoji_to_noto_name(signal_emoji_name)}.png",
out_path / signal_emoji_name,
)
except FileNotFoundError:
print(
f"Missing Noto emoji: {signal_emoji_name}",
file=sys.stderr,
)
continue
print(out_path.relative_to(asar_root))
if __name__ == "__main__":
_main()
@@ -1,316 +0,0 @@
{
stdenv,
lib,
fetchurl,
autoPatchelfHook,
noto-fonts-color-emoji,
dpkg,
libarchive,
asar,
rsync,
python3,
buildPackages,
nixosTests,
gtk3,
atk,
at-spi2-atk,
cairo,
pango,
pipewire,
gdk-pixbuf,
glib,
freetype,
fontconfig,
dbus,
libx11,
libxshmfence,
libxcb,
libxi,
libxcursor,
libxdamage,
libxrandr,
libxcomposite,
libxext,
libxfixes,
libxrender,
libxtst,
libxscrnsaver,
nss,
nspr,
alsa-lib,
cups,
expat,
libuuid,
at-spi2-core,
libappindicator-gtk3,
libgbm,
libwebp,
# Runtime dependencies:
systemdLibs,
libnotify,
libdbusmenu,
libpulseaudio,
xdg-utils,
wayland,
# command line arguments which are always set e.g "--password-store=kwallet6"
commandLineArgs,
}:
{
pname,
libdir,
bindir,
extractPkg,
version,
hash,
url,
}:
let
inherit (stdenv) targetPlatform;
ARCH = if targetPlatform.isAarch64 then "arm64" else "x64";
# Noto Color Emoji PNG files for emoji replacement; see below.
noto-fonts-color-emoji-png = noto-fonts-color-emoji.overrideAttrs (prevAttrs: {
pname = "noto-fonts-color-emoji-png";
# The build produces 136×128 PNGs by default for arcane font
# reasons, but we want square PNGs.
buildFlags = prevAttrs.buildFlags or [ ] ++ [ "BODY_DIMENSIONS=128x128" ];
makeTargets = [ "compressed" ];
installPhase = ''
runHook preInstall
mkdir -p $out/share
mv build/compressed_pngs $out/share/noto-fonts-color-emoji-png
python3 add_aliases.py --srcdir=$out/share/noto-fonts-color-emoji-png
runHook postInstall
'';
});
noto-emoji-sheet-32 = fetchurl {
url = "https://raw.githubusercontent.com/iamcal/emoji-data/refs/tags/v16.0.0/sheet_google_32.png";
hash = "sha256-tBfp9s1LvBBla7/V4TtumiVFtV5qTPcxLXW+H6qjSVI=";
};
noto-emoji-sheet-64 = fetchurl {
url = "https://raw.githubusercontent.com/iamcal/emoji-data/refs/tags/v16.0.0/sheet_google_64.png";
hash = "sha256-eVoMWY0WLJpKriPyGIxge4ybwZEst9hDgkWfjekaOuE=";
};
in
stdenv.mkDerivation (finalAttrs: {
inherit pname version;
# 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}/lib/${dir}/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 {
inherit url hash;
recursiveHash = true;
downloadToTemp = true;
nativeBuildInputs = [
(if ARCH == "x64" then dpkg else libarchive)
asar
];
# Signal ships the Apple emoji set without a licence via an npm
# package and upstream does not seem terribly interested in fixing
# this; see:
#
# * <https://github.com/signalapp/Signal-Android/issues/5862>
# * <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>
#
# We work around this by replacing it with the Noto Color Emoji
# set, which is available under a FOSS licence and more likely to
# be used on a NixOS machine anyway. The Apple emoji are removed
# during `fetchurl` to ensure that the build doesnt cache the
# unlicensed emoji files, but the rest of the work is done in the
# main derivation.
postFetch = ''
${extractPkg}
asar extract "$out/${libdir}/resources/app.asar" $out/asar-contents
rm -r \
"$out/${libdir}/resources/app.asar"{,.unpacked} \
$out/asar-contents/images/emoji-sheet-32.webp \
$out/asar-contents/images/emoji-sheet-64.webp
'';
};
nativeBuildInputs = [
rsync
asar
python3
autoPatchelfHook
# 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 = [
alsa-lib
at-spi2-atk
at-spi2-core
atk
cairo
cups
dbus
expat
fontconfig
freetype
gdk-pixbuf
glib
gtk3
libx11
libxscrnsaver
libxcomposite
libxcursor
libxdamage
libxext
libxfixes
libxi
libxrandr
libxrender
libxtst
libappindicator-gtk3
libpulseaudio
libnotify
libuuid
libgbm
nspr
nss
pango
systemdLibs
libxcb
libxshmfence
];
runtimeDependencies = [
systemdLibs
libappindicator-gtk3
libnotify
libdbusmenu
pipewire
xdg-utils
wayland
];
dontBuild = true;
dontConfigure = true;
unpackPhase = ''
rsync -a --chmod=+w $src/ .
'';
installPhase = ''
runHook preInstall
mkdir -p $out/lib
mv usr/share $out/share
mv "${libdir}" "$out/lib/signal-desktop"
# Symlink to bin
mkdir -p $out/bin
ln -s "$out/lib/signal-desktop/signal-desktop" $out/bin/${finalAttrs.meta.mainProgram}
# 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=$(
python3 ${./copy-noto-emoji.py} \
${noto-fonts-color-emoji-png}/share/noto-fonts-color-emoji-png \
asar-contents
)
# Replace the URL used for fetching large versions of emoji with
# the local path to our copied PNGs.
substituteInPlace asar-contents/preload.bundle.js \
--replace-fail \
'emoji://jumbo?emoji=' \
"file://$out/lib/signal-desktop/resources/app.asar/$emojiPrefix/"
# `asar(1)` copies files from the corresponding `.unpacked`
# directory when extracting, and will put them back in the modified
# archive if you dont specify them again when repacking. Signal
# leaves their native `.node` libraries unpacked, so we match that.
asar pack \
--unpack '*.node' \
asar-contents \
"$out/lib/signal-desktop/resources/app.asar"
runHook postInstall
'';
preFixup = ''
gappsWrapperArgs+=(
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}"
--suffix PATH : ${lib.makeBinPath [ xdg-utils ]}
--add-flags ${lib.escapeShellArg commandLineArgs}
)
# Fix the desktop link
substituteInPlace $out/share/applications/signal-desktop.desktop \
--replace-fail "/${bindir}/signal-desktop" ${finalAttrs.meta.mainProgram}
mv $out/share/applications/signal{-desktop,}.desktop
# Note: The following path contains bundled libraries:
# $out/lib/signal-desktop/resources/app.asar.unpacked/node_modules/
patchelf --add-needed ${libpulseaudio}/lib/libpulse.so "$out/lib/signal-desktop/resources/app.asar.unpacked/node_modules/@signalapp/ringrtc/build/linux/libringrtc-${ARCH}.node"
'';
passthru = {
# Tests if the application launches and waits for "Link your phone to Signal Desktop":
tests.application-launch = nixosTests.signal-desktop;
updateScript.command = [ ./update.sh ];
};
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/";
changelog = "https://github.com/signalapp/Signal-Desktop/releases/tag/v${finalAttrs.version}";
license = [
lib.licenses.agpl3Only
# Various npm packages
lib.licenses.free
lib.licenses.asl20 # noto-emoji
lib.licenses.mit # emoji-data
];
maintainers = with lib.maintainers; [
eclairevoyant
mic92
equirosa
bkchr
emily
Gliczy
];
mainProgram = "signal-desktop";
platforms = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
})
@@ -1,11 +0,0 @@
{
stdenv,
callPackage,
commandLineArgs ? "",
}:
if stdenv.hostPlatform.system == "aarch64-linux" then
callPackage ./signal-desktop-aarch64.nix { inherit commandLineArgs; }
else if stdenv.hostPlatform.isDarwin then
callPackage ./signal-desktop-darwin.nix { }
else
callPackage ./signal-desktop.nix { inherit commandLineArgs; }
@@ -1,15 +0,0 @@
[tool.mypy]
files = ["*.py"]
strict = true
[tool.ruff]
line-length = 80
[tool.ruff.lint]
select = ["ALL"]
ignore = ["COM812", "D203", "D213", "ISC001", "T201"]
allowed-confusables = [""]
[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = "dynamic"
@@ -1,15 +0,0 @@
{ callPackage, commandLineArgs }:
callPackage ./generic.nix { inherit commandLineArgs; } {
pname = "signal-desktop-bin";
version = "7.90.0";
libdir = "usr/lib64/signal-desktop";
bindir = "usr/bin";
extractPkg = ''
mkdir -p $out
bsdtar -xf $downloadedFile -C "$out"
'';
url = "https://download.copr.fedorainfracloud.org/results/useidel/signal-desktop/fedora-42-aarch64/10149422-signal-desktop/signal-desktop-7.90.0-1.fc42.aarch64.rpm";
hash = "sha256-+6aIB/UF7oZ7I4MtDsYCOhQxiaTpIyXGZ5WLdJto7Us=";
}
@@ -1,61 +0,0 @@
{
stdenv,
lib,
fetchurl,
_7zz,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "signal-desktop-bin";
version = "7.90.0";
src = fetchurl {
url = "https://updates.signal.org/desktop/signal-desktop-mac-universal-${finalAttrs.version}.dmg";
hash = "sha256-61JsAPeGVNJpuUDAv3nA0WNr15C+e5NvsT0ICT2dolc=";
};
sourceRoot = ".";
nativeBuildInputs = [ _7zz ];
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out/Applications
cp -r Signal.app $out/Applications
runHook postInstall
'';
passthru = {
updateScript.command = [ ./update.sh ];
};
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/";
downloadPage = "https://signal.org/download/macos/";
changelog = "https://github.com/signalapp/Signal-Desktop/releases/tag/v${finalAttrs.version}";
license = with lib.licenses; [
agpl3Only
# Various npm packages
free
# has non-redistributable Apple emoji packaged, see main derivation
unfree
];
maintainers = with lib.maintainers; [ nickhu ];
platforms = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
})
@@ -1,12 +0,0 @@
{ callPackage, commandLineArgs }:
callPackage ./generic.nix { inherit commandLineArgs; } rec {
pname = "signal-desktop-bin";
version = "7.90.0";
libdir = "opt/Signal";
bindir = libdir;
extractPkg = "dpkg-deb -x $downloadedFile $out";
url = "https://updates.signal.org/desktop/apt/pool/s/signal-desktop/signal-desktop_${version}_amd64.deb";
hash = "sha256-m9tBldv1WvfdLrORIuJQYBQ72rBRHgXSAk0PrwZtAB4=";
}
@@ -1,35 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash common-updater-scripts curl coreutils jq
set -ex
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
latestTag=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} \
"https://api.github.com/repos/signalapp/Signal-Desktop/releases/latest" \
| jq -r ".tag_name")
latestVersion="$(expr "$latestTag" : 'v\(.*\)')"
latestBuildInfoAarch64=$(curl \
"https://copr.fedorainfracloud.org/api_3/package/?ownername=useidel&projectname=signal-desktop&packagename=signal-desktop&with_latest_succeeded_build=true" \
| jq '.builds.latest_succeeded')
latestBuildAarch64=$(jq '.id' <<< $latestBuildInfoAarch64)
latestVersionAarch64=$(jq -r '.source_package.version' <<< $latestBuildInfoAarch64)
latestPrettyVersionAarch64="${latestVersionAarch64%-*}"
darwinHash="$(nix --extra-experimental-features nix-command hash to-sri --type sha256 "$(nix-prefetch-url "https://updates.signal.org/desktop/signal-desktop-mac-universal-${latestVersion}.dmg")")"
echo "Updating signal-desktop for x86_64-linux"
update-source-version signal-desktop-bin "$latestVersion" \
--system=x86_64-linux \
--file="$SCRIPT_DIR/signal-desktop.nix"
echo "Updating signal-desktop for aarch64-linux"
update-source-version signal-desktop-bin "$latestPrettyVersionAarch64" "" \
"https://download.copr.fedorainfracloud.org/results/useidel/signal-desktop/fedora-42-aarch64/$(printf "%08d" $latestBuildAarch64)-signal-desktop/signal-desktop-$latestVersionAarch64.fc42.aarch64.rpm" \
--system=aarch64-linux \
--file="$SCRIPT_DIR/signal-desktop-aarch64.nix"
echo "Updating signal-desktop for darwin"
sed -i "s|version = \".*\";|version = \"${latestVersion}\";|" "$SCRIPT_DIR/signal-desktop-darwin.nix"
sed -i "s|hash = \"sha256-[^\"]*\";|hash = \"${darwinHash}\";|" "$SCRIPT_DIR/signal-desktop-darwin.nix"
+1
View File
@@ -1758,6 +1758,7 @@ mapAliases {
shipyard = throw "'shipyard' has been renamed to/replaced by 'jumppad'"; # Converted to throw 2025-10-27
siduck76-st = throw "'siduck76-st' has been renamed to/replaced by 'st-snazzy'"; # Converted to throw 2025-10-27
sierra-breeze-enhanced = throw "'sierra-breeze-enhanced' has been removed, as it is only compatible with Plasma 5, which is EOL"; # Added 2025-08-20
signal-desktop-bin = throw "'signal-desktop-bin' has been replaced by 'signal-desktop' which is built from source"; # Added 2026-03-02
signal-desktop-source = throw "'signal-desktop-source' has been renamed to/replaced by 'signal-desktop'"; # Converted to throw 2025-10-27
simpleBluez = warnAlias "'simpleBluez' has been renamed to 'simplebluez'" simplebluez; # Added 2026-02-18
simpleDBus = warnAlias "'simpleDBus' has been renamed to 'simpledbus'" simpledbus; # Added 2026-02-12