zaphyra's git: tgcNUR

fork of https://git.transgirl.cafe/zaphoid/tgc-nix-user-repository

commit 7bf2e9c19c8633a06f0d035a4867feebc99af1fb
parent 56f6b2906cd58eaba58e38a711afce0ab3c25c47
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Tue, 19 Aug 2025 13:27:51 +0200

packages: add `mautrix-telegramgo`
1 file changed, 49 insertions(+), 0 deletions(-)
A
packages/mautrix-telegramgo/package.nix
|
49
+++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/packages/mautrix-telegramgo/package.nix b/packages/mautrix-telegramgo/package.nix
@@ -0,0 +1,49 @@
+{
+  tgcMaintainers,
+  lib,
+  stdenv,
+  buildGoModule,
+  fetchFromGitHub,
+  olm,
+  # This option enables the use of an experimental pure-Go implementation of
+  # the Olm protocol instead of libolm for end-to-end encryption. Using goolm
+  # is not recommended by the mautrix developers, but they are interested in
+  # people trying it out in non-production-critical environments and reporting
+  # any issues they run into.
+  withGoolm ? true,
+}:
+
+let
+  cppStdLib = if stdenv.hostPlatform.isDarwin then "-lc++" else "-lstdc++";
+
+in
+buildGoModule rec {
+  pname = "mautrix-telegramgo";
+  rev = "3ae88caa8045a6d36da5afd46423038b3d7591fc";
+  version = "0.0.0-${builtins.substring 0 6 rev}";
+  hash = "sha256-o4mmYBkws+DpXksUmzkF0XdFPn+iKCKdoa4XbEOXqr4=";
+
+  src = fetchFromGitHub {
+    owner = "mautrix";
+    repo = "telegramgo";
+    inherit rev hash;
+  };
+
+  buildInputs = (lib.optional (!withGoolm) olm) ++ (lib.optional withGoolm stdenv.cc.cc.lib);
+
+  CGO_LDFLAGS = lib.optional withGoolm [ cppStdLib ];
+
+  tags = lib.optional withGoolm "goolm";
+
+  doCheck = false;
+
+  vendorHash = "sha256-SNQxZYbFE8DzGF8Ubx6nho93J1hmNG2XnQ1re8alqPw=";
+
+  meta = with lib; {
+    homepage = "https://github.com/mautrix/telegramgo";
+    description = "Go rewrite of mautrix-telegram";
+    license = licenses.agpl3Plus;
+    maintainers = [ tgcMaintainers.zaphyra ];
+    mainProgram = "mautrix-telegram";
+  };
+}