1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-29 19:17:45 +00:00

fix: fix http configs

This commit is contained in:
RGBCube 2025-02-23 20:00:59 +03:00
parent 51c941ed04
commit 63e9359aad
7 changed files with 74 additions and 58 deletions

View file

@ -38,7 +38,7 @@ in {
database.user = "grafana";
server.domain = fqdn;
server.http_addr = "[::1]";
server.http_addr = "::1";
server.http_port = port;
users.default_theme = "system";
@ -75,4 +75,3 @@ in {
};
};
}

View file

@ -7,29 +7,40 @@
fqdn = "chat.${domain}";
port = 8002;
configClient."m.homeserver".base_url = "https://${fqdn}";
configServer."m.server" = "${fqdn}:443";
wellKnownResponse = data: /* nginx */ ''
${config.services.nginx.headers}
add_header Access-Control-Allow-Origin * always;
configWellKnownResponse.locations = let
wellKnownResponse = data: ''
${config.services.nginx.headers}
add_header Access-Control-Allow-Origin *;
default_type application/json;
return 200 '${strings.toJSON data}';
'';
default_type application/json;
return 200 '${strings.toJSON data}';
'';
in {
"= /.well-known/matrix/client".extraConfig = wellKnownResponse configClient;
"= /.well-known/matrix/server".extraConfig = wellKnownResponse configServer;
configWellKnownResponse.locations = {
"= /.well-known/matrix/client".extraConfig = wellKnownResponse {
"m.homeserver".base_url = "https://${fqdn}";
};
"= /.well-known/matrix/server".extraConfig = wellKnownResponse {
"m.server" = "${fqdn}:443";
};
};
configNotFoundLocation = {
locations."/".extraConfig = "return 404;";
extraConfig = /* nginx */ ''
error_page 404 /404.html;
'';
extraConfig = "error_page 404 /404.html;";
locations."/404".extraConfig = "internal;";
locations."/".extraConfig = /* nginx */ ''
return 404;
'';
locations."/assets/".extraConfig = "return 301 https://${domain}$request_uri;";
locations."/404".extraConfig = /* nginx */ ''
internal;
'';
locations."/assets/".extraConfig = /* nginx */ ''
return 301 https://${domain}$request_uri;
'';
};
in {
imports = [(self + /modules/nginx.nix)];
@ -93,7 +104,7 @@ in {
services.nginx.virtualHosts.${domain} = configWellKnownResponse;
services.nginx.virtualHosts.${fqdn} = merge config.services.nginx.sslTemplate configWellKnownResponse configNotFoundLocation {
root = "${pathSite}";
root = pathSite;
locations."/_matrix".proxyPass = "http://[::1]:${toString port}";
locations."/_synapse/client".proxyPass = "http://[::1]:${toString port}";

View file

@ -4,7 +4,7 @@
fqdn = "cloud.${domain}";
packageNextcloud = pkgs.nextcloud29;
packageNextcloud = pkgs.nextcloud30;
in {
imports = [(self + /modules/nginx.nix)];
@ -35,14 +35,15 @@ in {
after = [ "postgresql.service" ];
requires = [ "postgresql.service" ];
script = mkAfter ''
nextcloud-occ theming:config name "RGBCube's Depot"
nextcloud-occ theming:config slogan "RGBCube's storage of insignificant data."
script = mkAfter /* shell */ ''
# TODO: Nextcloud 30 removed these. Find another way.
# nextcloud-occ theming:config name "RGBCube's Depot"
# nextcloud-occ theming:config slogan "RGBCube's storage of insignificant data."
nextcloud-occ theming:config color "#000000"
nextcloud-occ theming:config background backgroundColor
# nextcloud-occ theming:config color "#000000"
# nextcloud-occ theming:config background backgroundColor
nextcloud-occ theming:config logo ${./icon.gif}
# nextcloud-occ theming:config logo ${./icon.gif}
'';
};
@ -98,10 +99,8 @@ in {
extraAppsEnable = true;
extraApps = {
inherit (packageNextcloud.packages.apps)
bookmarks calendar contacts deck
forms impersonate mail # groupfolders impersonate mail
maps notes polls previewgenerator; # tasks;
# Add: files_markdown files_texteditor memories news
bookmarks calendar contacts deck forms
impersonate mail maps notes previewgenerator;
};
nginx.recommendedHttpHeaders = true;

3
hosts/cube/site.nix Normal file
View file

@ -0,0 +1,3 @@
{ self, ... }: {
imports = [(self + /modules/site.nix)];
}