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
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
{
options.custom.web-services.glance = {
@ -27,38 +57,22 @@ in
server.port = cfg.port;
pages = lib.singleton {
name = "Services";
name = "Home";
center-vertically = true;
hide-desktop-navigation = true;
columns = lib.singleton {
size = "full";
widgets =
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;
}
);
}
);
widgets = [
{
type = "search";
search-engine = "google";
autofocus = true;
}
{
type = "split-column";
widgets = servicesWidgets;
}
];
};
};
};