Compare commits

...

7 commits

2 changed files with 24 additions and 9 deletions

View file

@ -78,7 +78,12 @@ in
dnsServers = lib.mkOption { dnsServers = lib.mkOption {
type = lib.types.listOf lib.types.nonEmptyStr; type = lib.types.listOf lib.types.nonEmptyStr;
default = if (blocking-nameservers != [ ]) then blocking-nameservers else recursive-nameservers; default =
{
"client" = if (blocking-nameservers != [ ]) then blocking-nameservers else recursive-nameservers;
"server" = recursive-nameservers;
}
.${cfg.role};
}; };
implementation = lib.mkOption { implementation = lib.mkOption {

View file

@ -8,6 +8,9 @@
let let
cfg = config.custom.web-services.glance; cfg = config.custom.web-services.glance;
perHostDomains =
perHostSitesWidget.widgets |> lib.concatMap (widget: widget.sites) |> lib.map (site: site.domain);
perHostSitesWidget = perHostSitesWidget =
allHosts allHosts
|> lib.attrValues |> lib.attrValues
@ -18,8 +21,7 @@ let
sites = sites =
host.config.custom.meta.sites host.config.custom.meta.sites
|> lib.attrValues |> lib.attrValues
|> lib.filter (site: site.domain |> lib.hasSuffix host.config.custom.networking.overlay.fqdn) |> lib.filter (site: site.domain |> lib.hasSuffix host.config.custom.networking.overlay.fqdn);
|> lib.map (site: site // { timeout = "5s"; });
}) })
|> lib.filter ({ sites, ... }: sites != [ ]) |> lib.filter ({ sites, ... }: sites != [ ])
|> (widgets: { |> (widgets: {
@ -28,9 +30,6 @@ let
inherit widgets; inherit widgets;
}); });
perHostDomains =
perHostSitesWidget.widgets |> lib.concatMap (widget: widget.sites) |> lib.map (site: site.domain);
applicationSitesWidget = applicationSitesWidget =
allHosts allHosts
|> lib.attrValues |> lib.attrValues
@ -45,7 +44,7 @@ let
type = "monitor"; type = "monitor";
cache = "1m"; cache = "1m";
title = "${name} Services"; title = "${name} Services";
sites = value |> lib.map (site: site // { timeout = "5s"; }); sites = value;
} }
) )
|> (widgets: { |> (widgets: {
@ -92,6 +91,17 @@ let
</div> </div>
''; '';
}; };
dnsWidgets =
allHosts
|> lib.attrValues
|> lib.filter (host: host.config.custom.services.blocking-nameserver.enable)
|> lib.map (host: {
type = "dns-stats";
title = host.config.networking.hostName;
service = "adguard";
url = "https://${host.config.custom.services.blocking-nameserver.gui.domain}/";
});
in in
{ {
options.custom.web-services.glance = { options.custom.web-services.glance = {
@ -124,7 +134,7 @@ in
{ {
type = "search"; type = "search";
search-engine = "https://search.splitleaf.de/search?q={QUERY}"; search-engine = "https://search.splitleaf.de/search?q={QUERY}";
autofocus = false; autofocus = true;
} }
applicationSitesWidget applicationSitesWidget
perHostSitesWidget perHostSitesWidget
@ -132,7 +142,7 @@ in
} }
{ {
size = "small"; size = "small";
widgets = [ githubBadgeWidget ]; widgets = [ githubBadgeWidget ] ++ dnsWidgets;
} }
]; ];
}; };