feat: updated abstractions

This commit is contained in:
Nick 2025-12-10 18:09:00 -06:00
parent 4512d7a5d9
commit 9aab8c6444
31 changed files with 70 additions and 97 deletions

View file

@ -3,46 +3,63 @@ let
inherit (flake.config.machines.devices) mars;
inherit (flake.config.services) instances;
svc = service: interface: { inherit service interface; };
makeBookmarks =
{
suffix,
urlTemplate,
services,
}:
builtins.map (name: {
name = "${instances.${name}.label} ${suffix}";
url = urlTemplate name;
tags = instances.${name}.tags;
keyword = instances.${name}.short;
}) (builtins.map (service: instances.${service}.name) services);
builtins.map (
{ service, interface }:
let
name = instances.${service}.name;
interfaceData = instances.${name}.interfaces.${interface};
in
{
name = "${instances.${name}.label} ${suffix}";
url = urlTemplate name interfaceData;
tags = instances.${name}.tags;
keyword = instances.${name}.short;
}
) services;
instanceList = [
instances.firefly-iii.name
instances.forgejo.name
instances.jellyfin.name
instances.mastodon.name
instances.ollama.name
instances.qbittorrent.name
instances.vaultwarden.name
];
bookmarkConfigs = [
{
suffix = "(Remote)";
urlTemplate = name: "https://${instances.${name}.domains.url0}";
services = instanceList;
urlTemplate = name: iface: "https://${iface.domain}";
services = [
(svc instances.firefly-iii.name "interface0")
(svc instances.forgejo.name "interface0")
(svc instances.jellyfin.name "interface0")
(svc instances.mastodon.name "interface0")
(svc instances.ollama.name "interface0")
(svc instances.qbittorrent.name "interface0")
(svc instances.vaultwarden.name "interface0")
];
}
{
suffix = "(Server)";
urlTemplate =
name: "http://${instances.${name}.interface.ip}:${builtins.toString instances.${name}.ports.port0}";
services = instanceList;
name: iface: "http://${iface.microvm.ip}:${builtins.toString instances.${name}.ports.port0}";
services = [
(svc instances.firefly-iii.name "interface0")
(svc instances.forgejo.name "interface0")
(svc instances.jellyfin.name "interface0")
(svc instances.mastodon.name "interface0")
(svc instances.ollama.name "interface0")
(svc instances.qbittorrent.name "interface0")
(svc instances.vaultwarden.name "interface0")
];
}
{
suffix = "(Desktop)";
urlTemplate = name: "http://${mars.ip.address0}:${builtins.toString instances.${name}.ports.port0}";
urlTemplate =
name: iface: "http://${mars.ip.address0}:${builtins.toString instances.${name}.ports.port0}";
services = [
instances.ollama.name
instances.syncthing.name
(svc instances.ollama.name "interface0")
(svc instances.syncthing.name "interface0")
];
}
];
@ -52,7 +69,7 @@ let
flatBookmarks = [
{
name = instances.web.label;
url = "http://${instances.web.localhost.address2}";
url = "http://${instances.web.addresses.address2}";
tags = instances.web.tags;
keyword = instances.web.label;
}

View file

@ -1,9 +1,6 @@
{ flake, osConfig, ... }:
{ flake, ... }:
let
inherit (flake.config.services) instances;
inherit (flake.config.machines) devices;
localhost = instances.web.localhost.address0;
hostname = osConfig.networking.hostName;
in
{
"${instances.jellyfin.label}" = {
@ -13,26 +10,26 @@ in
icon = ./icons/jf.png;
urls = [
{
template = "https://${instances.jellyfin.subdomain}.${instances.web.domains.url0}/web/#/search.html?query={searchTerms}";
}
];
};
"${instances.searx.label}" = {
definedAliases = [
"@sx"
];
icon = ./icons/sx.png;
urls = [
{
template =
(
if hostname == devices.mars.name then
"http://${localhost}:${toString instances.searx.ports.port0}"
else
"https://${instances.searx.subdomain}.${instances.web.domains.url0}"
)
+ "/search?q={searchTerms}";
template = "https://${instances.jellyfin.interfaces.interface0.domain}/web/#/search.html?query={searchTerms}";
}
];
};
# "${instances.searx.label}" = {
# definedAliases = [
# "@sx"
# ];
# icon = ./icons/sx.png;
# urls = [
# {
# template =
# (
# if hostname == devices.mars.name then
# "http://${localhost}:${toString instances.searx.ports.port0}"
# else
# "https://${instances.searx.subdomain}.${instances.web.domains.url0}"
# )
# + "/search?q={searchTerms}";
# }
# ];
# };
}