1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-30 03:27:45 +00:00

fix: fix import graph and errors

This commit is contained in:
RGBCube 2025-02-23 14:35:46 +03:00
parent f2ab446c48
commit d8bcbab825
7 changed files with 29 additions and 21 deletions

View file

@ -1,14 +1,16 @@
{ config, lib, pkgs, ... }: let
{ self, config, lib, pkgs, ... }: let
inherit (config.networking) domain;
inherit (lib) enabled mkConst;
in {
options.nginx.sslTemplate = mkConst {
imports = [(self + /modules/acme)];
options.services.nginx.sslTemplate = mkConst {
forceSSL = true;
quic = true;
useACMEHost = config.networking.domain;
};
options.nginx.headers = mkConst ''
options.services.nginx.headers = mkConst ''
# TODO: Not working for some reason.
add_header Access-Control-Allow-Origin $allow_origin;
add_header Access-Control-Allow-Methods $allow_methods;
@ -61,7 +63,7 @@ in {
~^https://.+\.${domain}$ "GET, HEAD, OPTIONS";
}
${config.nginx.headers}
${config.services.nginx.headers}
proxy_cookie_path / "/; secure; HttpOnly; SameSite=strict";
'';

View file

@ -1,4 +1,4 @@
{ config, lib, ... }: let
{ self, config, lib, ... }: let
inherit (config.networking) domain;
inherit (lib) enabled merge;
@ -9,15 +9,17 @@
locations."/404".extraConfig = "internal;";
};
in {
imports = [(self + /modules/nginx.nix)];
services.nginx = enabled {
virtualHosts.${domain} = merge config.nginx.sslTemplate configNotFoundLocation {
virtualHosts.${domain} = merge config.services.nginx.sslTemplate configNotFoundLocation {
root = pathSite;
locations."/".tryFiles = "$uri $uri.html $uri/index.html =404";
locations."/assets/".extraConfig = ''
if ($request_method = OPTIONS) {
${config.nginx.headers}
${config.services.nginx.headers}
add_header Content-Type text/plain;
add_header Content-Length 0;
return 204;
@ -27,11 +29,11 @@ in {
'';
};
virtualHosts."www.${domain}" = merge config.nginx.sslTemplate {
virtualHosts."www.${domain}" = merge config.services.nginx.sslTemplate {
locations."/".extraConfig = "return 301 https://${domain}$request_uri;";
};
virtualHosts._ = merge config.nginx.sslTemplate configNotFoundLocation {
virtualHosts._ = merge config.services.nginx.sslTemplate configNotFoundLocation {
root = pathSite;
locations."/".extraConfig = "return 404;";