diff --git a/hosts/defiant/configuration.nix b/hosts/defiant/configuration.nix index 15caac2..dcd76ff 100644 --- a/hosts/defiant/configuration.nix +++ b/hosts/defiant/configuration.nix @@ -16,7 +16,7 @@ ./services/gitea.nix ./services/hedgedoc.nix ./services/home-assistant.nix - ./services/matrix-synapse.nix + ./services/matrix ./services/metrics ./services/minecraft.nix ./services/vaultwarden.nix diff --git a/hosts/defiant/services/matrix/admin.nix b/hosts/defiant/services/matrix/admin.nix new file mode 100644 index 0000000..27f2025 --- /dev/null +++ b/hosts/defiant/services/matrix/admin.nix @@ -0,0 +1,13 @@ +{ config, pkgs, lib, ... }: +let + domain = "matrix-admin.home.feal.no"; + backend = "http://127.0.0.1:8008"; + synapse-admin = pkgs.callPackage ./adminPkg.nix { }; +in { + services.nginx.virtualHosts."${domain}" = { + locations."/".root = "${synapse-admin}"; + locations."/_synapse".proxyPass = "${backend}"; + locations."/_matrix".proxyPass = "${backend}"; + }; +} + diff --git a/hosts/defiant/services/matrix/adminPkg.nix b/hosts/defiant/services/matrix/adminPkg.nix new file mode 100644 index 0000000..256713b --- /dev/null +++ b/hosts/defiant/services/matrix/adminPkg.nix @@ -0,0 +1,14 @@ +{ lib, stdenvNoCC, fetchzip }: + +stdenvNoCC.mkDerivation rec { + name = "synapse-admin"; + version = "0.8.7"; + src = fetchzip { + url = "https://github.com/Awesome-Technologies/synapse-admin/releases/download/${version}/synapse-admin-${version}-dirty.tar.gz"; + hash = "sha256-maaiU9ilmzE5lV9Ofjpli4g08/UcgZ82FaIMRrfOy7s="; + }; + phases = [ "installPhase" ]; + installPhase = '' + cp -r $src $out + ''; +} diff --git a/hosts/defiant/services/matrix/default.nix b/hosts/defiant/services/matrix/default.nix new file mode 100644 index 0000000..67d01b7 --- /dev/null +++ b/hosts/defiant/services/matrix/default.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + imports = [ + ./synapse.nix + ./admin.nix + ]; +} + diff --git a/hosts/defiant/services/matrix-synapse.nix b/hosts/defiant/services/matrix/synapse.nix similarity index 100% rename from hosts/defiant/services/matrix-synapse.nix rename to hosts/defiant/services/matrix/synapse.nix