glance: Add search bar

This commit is contained in:
SebastianStork 2026-03-09 23:43:38 +01:00
parent b4122e5f6b
commit 7ac4050d85
Signed by: SebastianStork
SSH key fingerprint: SHA256:tRrGdjYOwgHxpSc/wTOZQZEjxcb15P0tyXRsbAfd+2Q

View file

@ -6,6 +6,36 @@
}: }:
let let
cfg = config.custom.web-services.glance; cfg = config.custom.web-services.glance;
servicesWidgets =
allHosts
|> lib.attrValues
|> lib.map (host: {
hostName = host.config.networking.hostName;
services = host.config.custom.meta.services |> lib.attrValues;
})
|> lib.filter ({ services, ... }: services != [ ])
|> lib.map (
{ hostName, services }:
{
type = "monitor";
cache = "1m";
title = "Services - ${hostName}";
sites =
services
|> lib.map (
{
name,
url,
icon,
}:
{
title = name;
inherit url icon;
}
);
}
);
in in
{ {
options.custom.web-services.glance = { options.custom.web-services.glance = {
@ -27,38 +57,22 @@ in
server.port = cfg.port; server.port = cfg.port;
pages = lib.singleton { pages = lib.singleton {
name = "Services"; name = "Home";
center-vertically = true;
hide-desktop-navigation = true;
columns = lib.singleton { columns = lib.singleton {
size = "full"; size = "full";
widgets = widgets = [
allHosts {
|> lib.attrValues type = "search";
|> lib.map (host: { search-engine = "google";
hostName = host.config.networking.hostName; autofocus = true;
services = host.config.custom.meta.services |> lib.attrValues; }
}) {
|> lib.filter ({ services, ... }: services != [ ]) type = "split-column";
|> lib.map ( widgets = servicesWidgets;
{ hostName, services }: }
{ ];
type = "monitor";
cache = "1m";
title = "Services - ${hostName}";
sites =
services
|> lib.map (
{
name,
url,
icon,
}:
{
title = name;
inherit url icon;
}
);
}
);
}; };
}; };
}; };