diff --git a/nixos/boxes/colony/vms/shill/containers/chatterbox.nix b/nixos/boxes/colony/vms/shill/containers/chatterbox.nix index 2a48d3a..8ae0415 100644 --- a/nixos/boxes/colony/vms/shill/containers/chatterbox.nix +++ b/nixos/boxes/colony/vms/shill/containers/chatterbox.nix @@ -45,10 +45,20 @@ in owner = "matrix-synapse"; group = "matrix-synapse"; }; + "chatterbox/doublepuppet.yaml" = { + owner = "matrix-synapse"; + group = "matrix-synapse"; + }; + "chatterbox/syncv3.env" = { owner = "matrix-syncv3"; group = "matrix-syncv3"; }; + + "chatterbox/mautrix-whatsapp.env" = { + owner = "matrix-whatsapp"; + group = "matrix-whatsapp"; + }; }; }; @@ -59,6 +69,9 @@ in users = with lib.my.c.ids; { users = { + matrix-synapse.extraGroups = [ + "mautrix-whatsapp" + ]; matrix-syncv3 = { isSystemUser = true; uid = uids.matrix-syncv3; @@ -168,6 +181,8 @@ in app_service_config_files = [ "/var/lib/heisenbridge/registration.yml" + config.age.secrets."chatterbox/doublepuppet.yaml".path + "/var/lib/mautrix-whatsapp/whatsapp-registration.yaml" ]; }; @@ -195,6 +210,46 @@ in ]; }; }; + + mautrix-whatsapp = { + enable = true; + environmentFile = config.age.secrets."chatterbox/mautrix-whatsapp.env".path; + settings = { + homeserver = { + address = "http://localhost:8008"; + domain = "nul.ie"; + }; + appservice = { + database = { + type = "postgres"; + uri = "$MAU_WAPP_PSQL_URI"; + }; + id = "whatsapp2"; + bot = { + username = "whatsapp2"; + displayname = "WhatsApp Bridge Bot"; + }; + }; + bridge = { + username_template = "wapp2_{{.}}"; + displayname_template = "{{or .BusinessName .PushName .JID}} (WA)"; + personal_filtering_spaces = true; + delivery_receipts = true; + allow_user_invite = true; + url_previews = true; + command_prefix = "!wa"; + login_shared_secret_map."nul.ie" = "$MAU_WAPP_DOUBLE_PUPPET_TOKEN"; + encryption = { + allow = true; + default = true; + require = true; + }; + permissions = { + "@dev:nul.ie" = "admin"; + }; + }; + }; + }; }; } (mkIf config.my.build.isDevVM { diff --git a/nixos/modules/tmproot.nix b/nixos/modules/tmproot.nix index 382a560..05ccd1e 100644 --- a/nixos/modules/tmproot.nix +++ b/nixos/modules/tmproot.nix @@ -505,6 +505,16 @@ in } ]; }) + (mkIf config.services.mautrix-whatsapp.enable { + my.tmproot.persistence.config.directories = [ + { + directory = "/var/lib/mautrix-whatsapp"; + mode = "0750"; + user = "mautrix-whatsapp"; + group = "mautrix-whatsapp"; + } + ]; + }) ])) ]); diff --git a/secrets/chatterbox/doublepuppet.yaml.age b/secrets/chatterbox/doublepuppet.yaml.age new file mode 100644 index 0000000..5bfaccc --- /dev/null +++ b/secrets/chatterbox/doublepuppet.yaml.age @@ -0,0 +1,31 @@ +-----BEGIN AGE ENCRYPTED FILE----- +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IFpCM2U2USB5WDhJ +U3BNdEFYR2xVb21wQmhuM3h2TWpwSm40aW5ycjJJZ0NQNjNEdDBNCllpZlRtcjFM +UE1TbE02ZStsMk44YVZ2T1piZmh3REFlV0Q0RWVGMERaRkEKLT4gWDI1NTE5IFRz +T1grT3ZMRmVUaWhFU1BJbnpDTDYvRUUwUTZYUFQ2OXhQbS9KeTlUWHMKQU9UaThT +bHFaYXM4VWhPU0xBZFI1WDkzdzlQUGlJNStjT2UwblZ0S1V4VQotPiBbbGBjW3wt +Z3JlYXNlICUgRiVYCk4rMVEzMnVMSTg4VHpPcTIvRkZZd20yMVlJbXdTK3UyTkVn +V3B1OFZiNCs1R0F0WmFYc3BDaW5FajNCUgotLS0gajBSMklJUDgzZlNFTlFkZTFm +amNxblljWkVsc2w5NUVZM0x4VGl2NWZDNApDqGhViG2eQSuIEEwEh2rxVBAVkCBj +EXUYBqrcqlRFRT+cN8EM+aT6ppUeVuuOv3aTYx+tM2M2yzjWvrckeVj0fr5GwpIT +vZaj2yceTl/6M/Z7fK5AT7SqFp/sxSJZcDWInPcPc3MfvcSC5ca7UFcTd/iqtpgD +gSkiD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7Q8gyf6gNJVpZuHrAEexCed3qhK+Ijl2SIvsTFCWLSokOPeX/F +cy7xQ94GuLZqPedDvZ8wVOQ3X1/E46lWoY1w3qzD5l1OHuDUqJcW1ae8lXTmh8Z0 +kxRFPfNaJA1y1NaD33t+gis7SA== +-----END AGE ENCRYPTED FILE----- diff --git a/secrets/chatterbox/mautrix-whatsapp.env.age b/secrets/chatterbox/mautrix-whatsapp.env.age new file mode 100644 index 0000000..1a84f2d --- /dev/null +++ b/secrets/chatterbox/mautrix-whatsapp.env.age @@ -0,0 +1,16 @@ +-----BEGIN AGE ENCRYPTED FILE----- +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IFpCM2U2USBTZGdy +cnNwTkkzOHBlcngzYTZycE11RlljK1RtSCthVkxSa1B0SllGZW1jCk1RbzVSMldJ +SFg4ZlFnT3ZJTTlsM0lWYlRTRkdMZU5YS2FpTmxCaVNSOGcKLT4gWDI1NTE5IFRU +RVF0NXV4bFB2ektiQVN0SkFvOXN3MGZFeDdHK25NQXBqelBvaVg3alkKaWhCRTkz +S2o5bjFWQ0VuZzZxTGpsOXBRajlGSmt3bURQN254SXhyRm8zNAotPiB7MFM0TDEr +Si1ncmVhc2UgJG0gNkggLAppL0RJQnJRQ09yb3IzaTNiQTBBOGlrbjEzNjhBNWdU +Z0VFZ1o1OEI5M3lOaHg3eW0xQlUvbVBGOEpwRXdDZlZXCjB1SSsvZmZtSlU2RzhY +ak5lcy9FbjVlZlVmMFUKLS0tIG5ZMXZhMDYrMU1DOThYNEZxTnI1d0I0TXlNeDU3 +ZkFoWnBVOEx1WjRmTncKZcV/oJCkeY+Tp4Xwdy5s+vuMpnhy0cndBUE4KrfkX7xd +NXTWQ1mQdy9W5MII8s1aFtxYoShZPsoNTikzZIAqxhTMHloUqKaAG0XKCKj1ZzcV +WMj8+IOnPD1y7uwETg7l0lw0u/L2bb37zrlvrf6JjA5b4iO79+wg9AvJigdbkNou +gfNFyZuxaIwM7FOakVWV8hKhKPYd1X0y3cUQCSb0/oiogHT+9KREXsL5Jt8hVoQ0 +r0asxVOASXxVRkEDQDe9RHnEMEo3+UOBtAB0DVSeGOa4LEt8SEoCfas5vo+LqMZs +fDA= +-----END AGE ENCRYPTED FILE-----