From c1833eb07cb20c4df48660c137fff13f09096ae7 Mon Sep 17 00:00:00 2001 From: Joakim Pettersvold Date: Sun, 13 Oct 2024 00:16:39 +0200 Subject: [PATCH] bicep/matrix/hookshot: Configure matrix-hookshot Co-authored-by: Daniel Olsen --- flake.nix | 2 +- hosts/bicep/services/matrix/default.nix | 1 + .../services/matrix/hookshot/default.nix | 57 +++++++++++++++++++ .../services/{ => matrix}/hookshot/module.nix | 0 4 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 hosts/bicep/services/matrix/hookshot/default.nix rename hosts/bicep/services/{ => matrix}/hookshot/module.nix (100%) diff --git a/flake.nix b/flake.nix index e0d0e378..b09a9863 100644 --- a/flake.nix +++ b/flake.nix @@ -57,7 +57,7 @@ rec { system = "x86_64-linux"; specialArgs = { - inherit nixpkgs-unstable inputs; + inherit unstablePkgs inputs; values = import ./values.nix; }; diff --git a/hosts/bicep/services/matrix/default.nix b/hosts/bicep/services/matrix/default.nix index e7cc45fa..abc7b483 100644 --- a/hosts/bicep/services/matrix/default.nix +++ b/hosts/bicep/services/matrix/default.nix @@ -10,6 +10,7 @@ ./mjolnir.nix ./discord.nix + ./hookshot ]; diff --git a/hosts/bicep/services/matrix/hookshot/default.nix b/hosts/bicep/services/matrix/hookshot/default.nix new file mode 100644 index 00000000..d7f70418 --- /dev/null +++ b/hosts/bicep/services/matrix/hookshot/default.nix @@ -0,0 +1,57 @@ +{ config, lib, unstablePkgs, inputs, ... }: + +{ + imports = [ + ./module.nix + ]; + + sops.secrets."matrix/registrations/matrix-hookshot" = { + sopsFile = ../../../../../secrets/bicep/matrix.yaml; + key = "registrations/matrix-hookshot"; + owner = config.users.users.matrix-synapse.name; + group = config.users.groups.keys-matrix-registrations.name; + }; + + systemd.services.matrix-hookshot = { + serviceConfig.SupplementaryGroups = [ config.users.groups.keys-matrix-registrations.name ]; + }; + + services.matrix-hookshot = { + enable = true; + package = unstablePkgs.matrix-hookshot; + registrationFile = config.sops.secrets."matrix/registrations/matrix-hookshot".path; + settings = { + bridge = { + bindAddress = "127.0.0.1"; + domain = "pvv.ntnu,no"; + url = "https://matrix.pvv.ntnu.no"; + mediaUrl = "https://matrix.pvv.ntnu.no"; + port = 9993; + }; + listeners = [ + { + bindAddress = "127.0.0.1"; + port = 9000; + resources = [ + "webhooks" + "metrics" + "provisioning" + "widgets" + ]; + } + ]; + generic = { + enabled = true; + }; + feeds = { + enabled = true; + }; + }; + }; + + services.matrix-hookshot.serviceDependencies = [ "matrix-synapse.target" "nginx.service" ]; + + services.matrix-synapse-next.settings = { + app_service_config_files = [ config.sops.secrets."matrix/registrations/matrix-hookshot".path ]; + }; +} diff --git a/hosts/bicep/services/hookshot/module.nix b/hosts/bicep/services/matrix/hookshot/module.nix similarity index 100% rename from hosts/bicep/services/hookshot/module.nix rename to hosts/bicep/services/matrix/hookshot/module.nix