From c9640ad7f54a66923c2284f7a36ef82e93d00c93 Mon Sep 17 00:00:00 2001 From: twoneis Date: Sun, 9 Mar 2025 21:13:13 +0100 Subject: [PATCH] test unix sockets --- modules/matrix/default.nix | 55 +++++++++++++++++++++----------------- modules/utils/prompt.fish | 5 ++++ 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/modules/matrix/default.nix b/modules/matrix/default.nix index 26991a2..66095f8 100644 --- a/modules/matrix/default.nix +++ b/modules/matrix/default.nix @@ -3,35 +3,40 @@ lib, ... }: let - inherit (lib) mkIf; + inherit (lib) mkIf mkMerge; inherit (lib.attrsets) genAttrs; cfg = config.conf.matrix; in - mkIf cfg.enable { - services.nginx.virtualHosts = genAttrs [cfg.domain.base cfg.domain.full] (domain: { - serverName = domain; - useACMEHost = cfg.domain.base; - forceSSL = true; - locations = { - "/.well-known/matrix/server" = { - return = "200 '{\"m.server\": \"${cfg.domain.full}:443\"}'"; + mkIf cfg.enable (mkMerge [ + { + services.nginx.virtualHosts = genAttrs [cfg.domain.base cfg.domain.full] (domain: { + serverName = domain; + useACMEHost = cfg.domain.base; + forceSSL = true; + locations = { + "/.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}\"}}'"; - }; - "/.well-known/matrix/support" = { - return = "200 '{\"contacts\": [{\"matrix_id\": \"@admin:${cfg.domain.full}\", \"email_address\": \"${cfg.email}\", \"role\": \"m.role.admin\"}]}'"; + }); + + services.conduwuit = { + enable = true; + settings.global = { + server_name = cfg.domain.full; + allow_registration = false; }; }; - }); - services.conduwuit = { - enable = true; - settings.global = { - server_name = cfg.domain.full; - allow_registration = false; - }; - }; - - networking.firewall.allowedTCPPorts = [8448]; - } + networking.firewall.allowedTCPPorts = [8448]; + } + { + services.nginx.virtualHosts.${cfg.domain.full}.locations."/".proxyPass = "http://unix:/run/conduwuit/socket"; + } + ]) diff --git a/modules/utils/prompt.fish b/modules/utils/prompt.fish index da7d859..3ade6fa 100644 --- a/modules/utils/prompt.fish +++ b/modules/utils/prompt.fish @@ -19,4 +19,9 @@ if test -n "$SSH_CLIENT" set ssh (set_color brblack)"$USER@$hostname" 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