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 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 { stateDir = mkOption {
default = "/var/lib/strojnadzor"; default = "/var/lib/strojnadzor";
type = types.str; type = types.str;
@ -90,8 +100,8 @@ in
services.nginx = { services.nginx = {
enable = true; enable = true;
virtualHosts = { virtualHosts = {
"golovizin.ru" = { "${cfg.hostName}" = {
serverAliases = [ "www.golovizin.ru" "xn--b1abndboscb.xn--p1ai" "www.xn--b1abndboscb.xn--p1ai" ]; serverAliases = cfg.hostNameAliases;
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
extraConfig = hsts + '' extraConfig = hsts + ''