47 lines
1.1 KiB
Nix
47 lines
1.1 KiB
Nix
|
{ config, ... }:
|
||
|
{
|
||
|
imports = [
|
||
|
./xslt_template.nix
|
||
|
./rclone_mount.nix
|
||
|
];
|
||
|
|
||
|
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||
|
|
||
|
services.nginx = {
|
||
|
enable = true;
|
||
|
virtualHosts."mirror.lewd.wtf" = {
|
||
|
serverName = "${config.variables.hostName}.${config.variables.domain}";
|
||
|
enableACME = true;
|
||
|
forceSSL = true;
|
||
|
root = "/var/www/mirror/mirror/";
|
||
|
locations = {
|
||
|
"/" = {
|
||
|
extraConfig = ''
|
||
|
if ($arg_format = "json") {
|
||
|
rewrite ^ /json$request_uri last;
|
||
|
}
|
||
|
autoindex on;
|
||
|
autoindex_format xml;
|
||
|
xslt_stylesheet /etc/nginx/mirror.xslt dirname='$1';
|
||
|
'';
|
||
|
};
|
||
|
"/json/" = {
|
||
|
alias = "/var/www/mirror/mirror/";
|
||
|
extraConfig = ''
|
||
|
autoindex on;
|
||
|
autoindex_format json;
|
||
|
'';
|
||
|
};
|
||
|
"/private/" = {
|
||
|
alias = "/var/www/mirror/private/";
|
||
|
extraConfig = ''
|
||
|
autoindex off;
|
||
|
'';
|
||
|
};
|
||
|
"~ \.xml$" = {
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
}
|