signal-desktop: Adds support for aarch64-linux

This adds support for `signal-desktop` on `aarch64-linux`. This is
achieved by leveraging a community deb package that builds it for
`aarch64`. A future version may switches to a full custom build of the
package, so that we don't need to use any debs at all.
This commit is contained in:
Bastian Köcher 2023-12-06 09:29:39 +01:00 committed by Jörg Thalheim
parent 449c6fb06b
commit 46e35b98e7
2 changed files with 27 additions and 11 deletions

View file

@ -1,12 +1,17 @@
{ callPackage }: builtins.mapAttrs (pname: attrs: callPackage ./generic.nix (attrs // { inherit pname; })) {
signal-desktop = {
{ callPackage, stdenv }: builtins.mapAttrs (pname: attrs: callPackage ./generic.nix (attrs // { inherit pname; })) {
signal-desktop = rec {
dir = "Signal";
version = "6.40.0";
version-aarch64 = "6.40.0";
url = "https://updates.signal.org/desktop/apt/pool/s/signal-desktop/signal-desktop_${version}_amd64.deb";
url-aarch64 = "https://github.com/0mniteck/Signal-Desktop-Mobian/raw/${version-aarch64}/builds/release/signal-desktop_${version-aarch64}_arm64.deb";
hash = "sha256-vyXHlycPSyEyv938IKzGM6pdERHHerx2CLY/U+WMrH4=";
hash-aarch64 = "sha256-3Pi0c+CGcJR1M4ll51m+B5PmGIcIjjlc0qa9b8rkMeU=";
};
signal-desktop-beta = {
signal-desktop-beta = rec {
dir = "Signal Beta";
version = "6.40.0-beta.2";
hash = "sha256-pfedkxbZ25DFgz+/N7ZEb9LwKrHuoMM+Zi+Tc21QPsg=";
url = "https://updates.signal.org/desktop/apt/pool/s/signal-desktop-beta/signal-desktop-beta_${version}_amd64.deb";
};
}

View file

@ -1,7 +1,11 @@
{ pname
, dir
, version
, version-aarch64 ? ""
, hash
, hash-aarch64 ? ""
, url
, url-aarch64 ? ""
, stdenv
, lib
, fetchurl
@ -51,8 +55,15 @@
, wayland
}:
stdenv.mkDerivation rec {
inherit pname version; # Please backport all updates to the stable channel.
let
inherit (stdenv) targetPlatform;
ARCH = if targetPlatform.isAarch64 then "arm64" else "x64";
final-version = if targetPlatform.isAarch64 then version-aarch64 else version;
in stdenv.mkDerivation rec {
inherit pname;
version = final-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:
@ -61,8 +72,8 @@ stdenv.mkDerivation rec {
# few additional steps and might not be the best idea.)
src = fetchurl {
url = "https://updates.signal.org/desktop/apt/pool/s/${pname}/${pname}_${version}_amd64.deb";
inherit hash;
url = if targetPlatform.isAarch64 then url-aarch64 else url;
hash = if targetPlatform.isAarch64 then hash-aarch64 else hash;
};
nativeBuildInputs = [
@ -163,7 +174,7 @@ stdenv.mkDerivation rec {
${if pname == "signal-desktop" then "--replace \"bin/signal-desktop\" \"bin/signal-desktop --use-tray-icon\"" else ""}
autoPatchelf --no-recurse -- "$out/lib/${dir}/"
patchelf --add-needed ${libpulseaudio}/lib/libpulse.so "$out/lib/${dir}/resources/app.asar.unpacked/node_modules/@signalapp/ringrtc/build/linux/libringrtc-x64.node"
patchelf --add-needed ${libpulseaudio}/lib/libpulse.so "$out/lib/${dir}/resources/app.asar.unpacked/node_modules/@signalapp/ringrtc/build/linux/libringrtc-${ARCH}.node"
'';
# Tests if the application launches and waits for "Link your phone to Signal Desktop":
@ -176,11 +187,11 @@ stdenv.mkDerivation rec {
"Signal Android" or "Signal iOS" app.
'';
homepage = "https://signal.org/";
changelog = "https://github.com/signalapp/Signal-Desktop/releases/tag/v${version}";
changelog = "https://github.com/signalapp/Signal-Desktop/releases/tag/v${final-version}";
license = lib.licenses.agpl3Only;
maintainers = with lib.maintainers; [ mic92 equirosa urandom ];
maintainers = with lib.maintainers; [ mic92 equirosa urandom bkchr ];
mainProgram = pname;
platforms = [ "x86_64-linux" ];
platforms = if builtins.stringLength version-aarch64 > 0 then [ "x86_64-linux" "aarch64-linux" ] else [ "x86_64-linux" ];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
}