From 6c38500e52b4d20400c2ae70392e69360937a634 Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 5 Oct 2022 19:29:40 -0700 Subject: [PATCH] servo: patch matrix-appservice-discord to allow 100% puppeting --- pkgs/matrix-appservice-discord/01-puppet.patch | 13 +++++++++++++ pkgs/matrix-appservice-discord/default.nix | 11 +++++++++++ pkgs/overlay.nix | 1 + 3 files changed, 25 insertions(+) create mode 100644 pkgs/matrix-appservice-discord/01-puppet.patch create mode 100644 pkgs/matrix-appservice-discord/default.nix diff --git a/pkgs/matrix-appservice-discord/01-puppet.patch b/pkgs/matrix-appservice-discord/01-puppet.patch new file mode 100644 index 00000000..4080d519 --- /dev/null +++ b/pkgs/matrix-appservice-discord/01-puppet.patch @@ -0,0 +1,13 @@ +diff --git a/src/clientfactory.ts b/src/clientfactory.ts +index b7fea47..587acfd 100644 +--- a/src/clientfactory.ts ++++ b/src/clientfactory.ts +@@ -53,7 +53,7 @@ export class DiscordClientFactory { + }); + + try { +- await this.botClient.login(this.config.botToken, true); ++ await this.botClient.login(this.config.botToken, false); + log.info("Waiting for shardReady signal"); + await waitPromise; + log.info("Got shardReady signal"); diff --git a/pkgs/matrix-appservice-discord/default.nix b/pkgs/matrix-appservice-discord/default.nix new file mode 100644 index 00000000..0a4ff198 --- /dev/null +++ b/pkgs/matrix-appservice-discord/default.nix @@ -0,0 +1,11 @@ +{ pkgs }: + +(pkgs.matrix-appservice-discord.overrideAttrs (upstream: { + # 2022-10-05: the service can't login as an ordinary user unless i change the source + doCheck = false; + patches = (upstream.patches or []) ++ [ + # bind to an IP address which is usable behind a netns + ./01-puppet.patch + ]; +})) + diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix index e72f2a9c..6aa49e2c 100644 --- a/pkgs/overlay.nix +++ b/pkgs/overlay.nix @@ -27,6 +27,7 @@ pleroma = prev.callPackage ./pleroma { }; # jackett doesn't allow customization of the bind address: this will probably always be here. jackett = prev.callPackage ./jackett { pkgs = prev; }; + matrix-appservice-discord = prev.callPackage ./matrix-appservice-discord { pkgs = prev; }; # mozilla keeps nerfing itself and removing configuration options firefox-unwrapped = prev.callPackage ./firefox-unwrapped { pkgs = prev; }; # fix abrupt HDD poweroffs as during reboot. patching systemd requires rebuilding nearly every package.