refactor: abstracting out bookmark info

This commit is contained in:
Nick 2025-07-07 20:20:01 -05:00
parent 77a31e9688
commit 532f798bd0
20 changed files with 87 additions and 119 deletions

View file

@ -1,11 +1,5 @@
{ flake, ... }:
let
inherit (flake.config.people)
user0
;
inherit (flake.config.people.users.${user0})
aliases
;
inherit (flake.config.machines.devices)
synology
ceres
@ -15,11 +9,64 @@ let
instances
;
in
{
name = "Self Hosted";
toolbar = false;
bookmarks = [
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);
bookmarkConfigs = [
{
suffix = "(Remote)";
urlTemplate = name: "https://${instances.${name}.domains.url0}";
services = [
"audiobookshelf"
"forgejo"
"glance"
"jellyfin"
"mastodon"
"ollama"
"opencloud"
"owncast"
"peertube"
"searx"
"vaultwarden"
];
}
{
suffix = "(Desktop)";
urlTemplate = name: "http://${mars.ip.address0}:${toString instances.${name}.ports.port0}";
services = [
"ollama"
"syncthing"
];
}
{
suffix = "(Server)";
urlTemplate = name: "http://${ceres.ip.address0}:${toString instances.${name}.ports.port0}";
services = [
"jellyfin"
];
}
{
suffix = "(Synology)";
urlTemplate = name: "http://${synology.ip.address0}:${toString instances.${name}.ports.port0}";
services = [
"syncthing"
];
}
];
generatedBookmarks = builtins.concatLists (builtins.map makeBookmarks bookmarkConfigs);
flatBookmarks = [
{
name = "Elm-Land Server";
url = "http://localhost:1234";
@ -30,42 +77,6 @@ in
];
keyword = "Website";
}
{
name = instances.opencloud.label;
url = "https://${instances.opencloud.domains.url0}";
tags = [
];
keyword = "Cloud";
}
{
name = instances.forgejo.label;
url = "https://${instances.forgejo.domains.url0}";
tags = [
];
keyword = instances.forgejo.label;
}
{
name = "${instances.jellyfin.label} (Internet)";
url = "https://${instances.jellyfin.domains.url0}";
tags = [ ];
keyword = instances.jellyfin.label;
}
{
name = "${instances.jellyfin.label} (Local)";
url = "http://${ceres.ip.address0}:${toString instances.jellyfin.ports.port1}";
tags = [ ];
keyword = instances.jellyfin.label;
}
{
name = instances.mastodon.label;
url = "https://${instances.mastodon.domains.url0}";
tags = [
];
keyword = instances.mastodon.label;
}
{
name = "Namecheap";
url = "https://www.namecheap.com";
@ -77,78 +88,16 @@ in
];
keyword = "Name";
}
{
name = instances.nextcloud.label;
url = "https://${instances.nextcloud.domains.url0}";
tags = [
];
keyword = instances.nextcloud.label;
}
{
name = "${instances.glance.label} (Local)";
url = "https://${instances.glance.domains.url0}";
tags = [
];
keyword = instances.glance.label;
}
{
name = "${instances.ollama.label} (Server)";
url = "https://${instances.ollama.domains.url0}";
tags = [ ];
keyword = instances.ollama.label;
}
{
name = "${instances.ollama.label} (Desktop)";
url = "http://${mars.ip.address0}:${toString instances.ollama.ports.port0}";
tags = [ ];
keyword = instances.ollama.label;
}
{
name = "Router";
url = "http://${instances.web.localhost.address2}";
tags = [
];
tags = [ ];
keyword = "Router";
}
{
name = "${instances.searx.label} (Internet)";
url = "https://${instances.searx.domains.url0}";
tags = [
];
keyword = instances.searx.label;
}
{
name = "${instances.syncthing.label} (${instances.synology.label})";
url = "http://${synology.ip.address0}:${toString instances.syncthing.ports.port0}";
tags = [
];
keyword = instances.syncthing.label;
}
{
name = "${instances.syncthing.label} (Desktop)";
url = "http://localhost:${toString instances.syncthing.ports.port0}";
tags = [
];
keyword = instances.syncthing.label;
}
{
name = instances.synology.label;
url = "https://${synology.ip.address0}:${toString instances.synology.ports.port0}";
tags = [
];
keyword = instances.synology.label;
}
{
name = instances.vaultwarden.label;
url = "https://${instances.vaultwarden.domains.url0}";
tags = [
];
keyword = instances.vaultwarden.label;
}
];
in
{
name = "Self Hosted";
toolbar = false;
bookmarks = flatBookmarks ++ generatedBookmarks;
}