about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/threema-desktop
diff options
context:
space:
mode:
authorP <WolfangAukang@users.noreply.github.com>2021-11-01 14:16:52 -0600
committerGitHub <noreply@github.com>2021-11-01 21:16:52 +0100
commit78dd8567c113a2d23736c7c6c064b55ddeb9d5ad (patch)
tree0d70c82547038b96f16cf836b2c3e50b3d551923 /pkgs/applications/networking/instant-messengers/threema-desktop
parentf538c07f2ebae64cc05526be65914a8212ab20b2 (diff)
threema-desktop: init at 1.0.3 (#143194)
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Diffstat (limited to 'pkgs/applications/networking/instant-messengers/threema-desktop')
-rw-r--r--pkgs/applications/networking/instant-messengers/threema-desktop/default.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/pkgs/applications/networking/instant-messengers/threema-desktop/default.nix b/pkgs/applications/networking/instant-messengers/threema-desktop/default.nix
new file mode 100644
index 0000000000000..30bfde7a96f1c
--- /dev/null
+++ b/pkgs/applications/networking/instant-messengers/threema-desktop/default.nix
@@ -0,0 +1,54 @@
+{ lib, stdenv, fetchurl, dpkg, autoPatchelfHook, makeWrapper, electron
+, alsa-lib, glibc, gtk3, libxshmfence, mesa, nss }:
+
+stdenv.mkDerivation rec {
+  pname = "threema-desktop";
+  version = "1.0.3";
+
+  src = fetchurl {
+    # As Threema only offers a Latest Release url, the plan is to upload each
+    # new release url to web.archive.org until their Github releases page gets populated.
+    url = "https://web.archive.org/web/20211027194646/https://releases.threema.ch/web-electron/v1/release/Threema-Latest.deb";
+    sha256 = "sha256-qiFv52nnyfHxCWTePmyxW/MgzFy3EUxmW6n+UIkw7tk=";
+  };
+
+  nativeBuildInputs = [
+    dpkg
+    autoPatchelfHook
+    makeWrapper
+  ];
+
+  buildInputs = [ alsa-lib glibc gtk3 libxshmfence mesa nss ];
+
+  dontBuild = true;
+  dontConfigure = true;
+
+  unpackPhase = ''
+    # Can't unpack with the common dpkg-deb -x method
+    dpkg --fsys-tarfile $src | tar --extract
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    # This will cause confusion, not needed
+    rm -r usr/bin
+    mv usr $out
+
+    runHook postInstall
+  '';
+
+  postFixup = ''
+    mv $out/share/applications/threema.desktop $out/share/applications/threema-desktop.desktop
+    makeWrapper ${electron}/bin/electron $out/bin/threema \
+      --add-flags $out/lib/threema/resources/app.asar
+  '';
+
+  meta = with lib; {
+    description = "Desktop client for Threema, a privacy-focused end-to-end encrypted mobile messenger";
+    homepage = "https://threema.ch";
+    license = licenses.agpl3Only;
+    maintainers = with maintainers; [ wolfangaukang ];
+    platforms = [ "x86_64-linux" ];
+  };
+}