test unix sockets

This commit is contained in:
twoneis 2025-03-09 21:13:13 +01:00
parent 25d02e5d3a
commit c9640ad7f5
2 changed files with 35 additions and 25 deletions

View file

@ -3,35 +3,40 @@
lib, lib,
... ...
}: let }: let
inherit (lib) mkIf; inherit (lib) mkIf mkMerge;
inherit (lib.attrsets) genAttrs; inherit (lib.attrsets) genAttrs;
cfg = config.conf.matrix; cfg = config.conf.matrix;
in in
mkIf cfg.enable { mkIf cfg.enable (mkMerge [
services.nginx.virtualHosts = genAttrs [cfg.domain.base cfg.domain.full] (domain: { {
serverName = domain; services.nginx.virtualHosts = genAttrs [cfg.domain.base cfg.domain.full] (domain: {
useACMEHost = cfg.domain.base; serverName = domain;
forceSSL = true; useACMEHost = cfg.domain.base;
locations = { forceSSL = true;
"/.well-known/matrix/server" = { locations = {
return = "200 '{\"m.server\": \"${cfg.domain.full}:443\"}'"; "/.well-known/matrix/server" = {
return = "200 '{\"m.server\": \"${cfg.domain.full}:443\"}'";
};
"/.well-known/matrix/client" = {
return = "200 '{\"m.homeserver\": {\"base_url\": \"https://${cfg.domain.full}\"}, \"org.matrix.msc3575.proxy\": {\"url\": \"https://${cfg.domain.full}\"}}'";
};
"/.well-known/matrix/support" = {
return = "200 '{\"contacts\": [{\"matrix_id\": \"@admin:${cfg.domain.full}\", \"email_address\": \"${cfg.email}\", \"role\": \"m.role.admin\"}]}'";
};
}; };
"/.well-known/matrix/client" = { });
return = "200 '{\"m.homeserver\": {\"base_url\": \"https://${cfg.domain.full}\"}, \"org.matrix.msc3575.proxy\": {\"url\": \"https://${cfg.domain.full}\"}}'";
}; services.conduwuit = {
"/.well-known/matrix/support" = { enable = true;
return = "200 '{\"contacts\": [{\"matrix_id\": \"@admin:${cfg.domain.full}\", \"email_address\": \"${cfg.email}\", \"role\": \"m.role.admin\"}]}'"; settings.global = {
server_name = cfg.domain.full;
allow_registration = false;
}; };
}; };
});
services.conduwuit = { networking.firewall.allowedTCPPorts = [8448];
enable = true; }
settings.global = { {
server_name = cfg.domain.full; services.nginx.virtualHosts.${cfg.domain.full}.locations."/".proxyPass = "http://unix:/run/conduwuit/socket";
allow_registration = false; }
}; ])
};
networking.firewall.allowedTCPPorts = [8448];
}

View file

@ -19,4 +19,9 @@ if test -n "$SSH_CLIENT"
set ssh (set_color brblack)"$USER@$hostname" set ssh (set_color brblack)"$USER@$hostname"
end end
set -l git
set -l IS_GIT_REPO (command git rev-parse --is-inside-work-tree &>/dev/null)
if test -n "$IS_GIT_REPO"
end
string join "" -- $stat $path \n $nix $prompt string join "" -- $stat $path \n $nix $prompt