Move site hostnames into options

This commit is contained in:
Andrey Golovizin 2020-03-10 16:41:59 +01:00
parent 00decb5f92
commit 1429212c4a

View file

@ -29,6 +29,16 @@ in
Whether to enable Strojnadzor
";
};
hostName = mkOption {
default = "golovizin.ru";
type = types.str;
description = "Main hostname.";
};
hostNameAliases = mkOption {
default = [ "www.golovizin.ru" "xn--b1abndboscb.xn--p1ai" "www.xn--b1abndboscb.xn--p1ai" ];
type = types.listOf types.str;
description = "Additional hostnames.";
};
stateDir = mkOption {
default = "/var/lib/strojnadzor";
type = types.str;
@ -90,8 +100,8 @@ in
services.nginx = {
enable = true;
virtualHosts = {
"golovizin.ru" = {
serverAliases = [ "www.golovizin.ru" "xn--b1abndboscb.xn--p1ai" "www.xn--b1abndboscb.xn--p1ai" ];
"${cfg.hostName}" = {
serverAliases = cfg.hostNameAliases;
forceSSL = true;
enableACME = true;
extraConfig = hsts + ''