cleard clutter

This commit is contained in:
emily 2024-01-09 16:30:36 +01:00
parent 19b0e9a5bb
commit a84a1ce3dd
Signed by: emily
GPG key ID: F6F4C66207FCF995
2 changed files with 1 additions and 29 deletions

View file

@ -8,34 +8,12 @@ let
add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Frame-Options "SAMEORIGIN" always;
add_header Referrer-Policy "same-origin" always; add_header Referrer-Policy "same-origin" always;
''; '';
virtHostCfg = {
forceSSL = true;
http3 = true;
quic = true;
};
autoIndex = '' autoIndex = ''
autoindex on; autoindex on;
autoindex_exact_size off; autoindex_exact_size off;
autoindex_format html; autoindex_format html;
autoindex_localtime on; autoindex_localtime on;
''; '';
createHost = builtins.mapAttrs (vhostName: vhostCfg:
with lib; let
mkRedirect = if builtins.hasAttr "redirectTo" vhostCfg
then {
useACMEHost = vhostCfg.redirectTo;
globalRedirect = vhostCfg.redirectTo;
} else (
optionalAttrs (!(builtins.hasAttr "useACMEHost" vhostCfg)) {
enableACME = true;
});
extraCfg = if builtins.hasAttr "extraConfig" vhostCfg
then { extraConfig = ''${vhostCfg.extraConfig} ${extraConfig}''; }
else { inherit extraConfig; };
in
virtHostCfg // mkRedirect // extraCfg //
(builtins.removeAttrs vhostCfg [ "redirectTo" "extraConfig" ])
);
in { in {
networking = { networking = {
hostName = "web02"; hostName = "web02";
@ -89,7 +67,7 @@ in {
${extraConfig} ${extraConfig}
''; '';
virtualHosts = createHost { createHost = {
"miau.zip" = { root = "/var/www/kyouma.net"; }; "miau.zip" = { root = "/var/www/kyouma.net"; };
"www.miau.zip" = { redirectTo = "miau.zip"; }; "www.miau.zip" = { redirectTo = "miau.zip"; };
"www.kyouma.net" = { redirectTo = "kyouma.net"; }; "www.kyouma.net" = { redirectTo = "kyouma.net"; };

View file

@ -15,12 +15,6 @@ with lib; let
http3 = true; http3 = true;
quic = true; quic = true;
}; };
autoIndex = ''
autoindex on;
autoindex_exact_size off;
autoindex_format html;
autoindex_localtime on;
'';
createHostFunc = builtins.mapAttrs (vhostName: vhostCfg: createHostFunc = builtins.mapAttrs (vhostName: vhostCfg:
with lib; let with lib; let
mkRedirect = if builtins.hasAttr "redirectTo" vhostCfg mkRedirect = if builtins.hasAttr "redirectTo" vhostCfg