Install element on matrix.coded.codes
diff --git a/modules/caddy.nix b/modules/caddy.nix
index a861694..c152989 100644
--- a/modules/caddy.nix
+++ b/modules/caddy.nix
@@ -2,12 +2,11 @@
services.caddy.enable = true;
services.caddy.configFile = lib.pipe ./caddy/caddyfile.nix [
import
+ (f: f { inherit pkgs lib; })
builtins.toJSON
(pkgs.writeText "caddy.json")
];
- services.caddy.package = pkgs.callPackage ../packages/caddy.nix {
- vendorSha256 = "sha256-3KcoOAB+YkOU8qKM75uQo58/dljRBmP25dionr9r2dc=";
- };
+ services.caddy.package = pkgs.callPackage ../packages/caddy.nix { };
services.caddy.user = "root";
systemd.services.caddy.serviceConfig.ProtectHome = lib.mkForce false;
}
diff --git a/modules/caddy/caddyfile.nix b/modules/caddy/caddyfile.nix
index 5d890bd..a7deb60 100644
--- a/modules/caddy/caddyfile.nix
+++ b/modules/caddy/caddyfile.nix
@@ -38,6 +38,26 @@
match = [{ host = hosts; }];
terminal = true;
};
+ HTTPFileServerRoute = hosts: root: {
+ handle = [
+ {
+ handler = "subroute";
+ routes = [
+ {
+ handle = [
+ {
+ handler = "file_server";
+ inherit root;
+ }
+ ];
+ }
+ ];
+ }
+ ];
+ match = [{ host = hosts; }];
+ terminal = true;
+ };
+
TCPReverseProxyRoute = ports: upstreams: {
listen = map (port: "0.0.0.0:${toString port}") ports;
routes = [
@@ -53,7 +73,7 @@
];
};
in
-{
+{ pkgs, lib }: {
apps = {
http = {
servers = {
@@ -250,6 +270,16 @@
match = [{ host = [ "coded.codes" ]; }];
terminal = true;
}
+ (HTTPFileServerRoute [ "matrix.coded.codes" ] (
+ pkgs.element-web.override {
+ conf = {
+ default_server_config = lib.pipe ./coded.codes/.well-known/matrix [
+ builtins.readFile
+ builtins.fromJSON
+ ];
+ };
+ }
+ ))
];
};
srv1 = {