{config, ...}: let
  inherit (config) sops;
  inherit (sops) templates placeholder;
  inherit (import ./lib.nix) toAppRegistration;
in {
  sops.secrets = {
    "mautrix-instagram/as_token" = {};
    "mautrix-instagram/hs_token" = {};
  };
  sops.templates = {
    "mautrix-instagram/appservice.yaml" = {
      owner = "matrix-synapse";
      content = toAppRegistration {
        id = "instagram";
        port = 29328;
        as_token = placeholder."mautrix-instagram/as_token";
        hs_token = placeholder."mautrix-instagram/hs_token";
        sender_localpart = "Gx8tLTHsxVlrdD3qibaPdaP9t7GhfciV";
        "de.sorunome.msc2409.push_ephemeral" = true;
      };
    };
  };

  # mautrix-instagram server currently in ansible/podman

  services.matrix-synapse.settings.app_service_config_files = [
    templates."mautrix-instagram/appservice.yaml".path
  ];
}
