options: cleanup, move dns into dns
This commit is contained in:
parent
8ce5e14da2
commit
8c0a902945
@ -2,10 +2,6 @@
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
utilities = import ./utilities.nix { inherit lib config; };
|
||||
inherit (utilities) architectInterfaceAddress;
|
||||
in
|
||||
{
|
||||
options.architect = {
|
||||
firewall = {
|
||||
@ -17,14 +13,6 @@ in
|
||||
type = types.listOf types.int;
|
||||
default = [ ];
|
||||
};
|
||||
openTCPVPN = mkOption {
|
||||
type = types.listOf types.int;
|
||||
default = [ ];
|
||||
};
|
||||
openUDPVPN = mkOption {
|
||||
type = types.listOf types.int;
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
|
||||
networks = mkOption {
|
||||
@ -118,12 +106,6 @@ in
|
||||
default = false;
|
||||
description = "If set to false, deny all WAN traffic.";
|
||||
};
|
||||
|
||||
deny = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = "IP address or CIDR block to deny.";
|
||||
};
|
||||
};
|
||||
});
|
||||
default = { };
|
||||
@ -136,6 +118,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: move to nginx
|
||||
config = {
|
||||
services.nginx.virtualHosts = mapAttrs
|
||||
(domain: conf: {
|
||||
@ -147,21 +130,12 @@ in
|
||||
proxyWebsockets = location.proxyWebsockets;
|
||||
extraConfig = ''
|
||||
${concatMapStringsSep "\n" (allowCIDR: "allow ${allowCIDR};") location.allow}
|
||||
${optionalString (!location.allowWAN) "deny all;"}
|
||||
${concatMapStringsSep "\n" (denyCIDR: "deny ${denyCIDR};") location.deny}
|
||||
${optionalString location.allowLan ''allow ${config.architect.networks."lan".net};''}
|
||||
${optionalString (!location.allowWAN) "deny all;"}
|
||||
'' + location.extraConfig;
|
||||
})
|
||||
conf.locations;
|
||||
})
|
||||
config.architect.vhost;
|
||||
|
||||
networking.extraHosts = concatStringsSep "\n" (
|
||||
mapAttrsToList
|
||||
(domain: conf: concatMapStringsSep "\n"
|
||||
(iface: "${architectInterfaceAddress iface} ${domain}")
|
||||
conf.dnsInterfaces)
|
||||
config.architect.vhost
|
||||
);
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user