From 532f798bd06838d7c55f482c9ec9d4a5954e60e2 Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 7 Jul 2025 20:20:01 -0500 Subject: [PATCH 1/2] refactor: abstracting out bookmark info --- modules/config/default.nix | 1 + .../instances/config/audiobookshelf.nix | 1 + modules/config/instances/config/forgejo.nix | 1 + modules/config/instances/config/glance.nix | 1 + modules/config/instances/config/jellyfin.nix | 5 +- modules/config/instances/config/mastodon.nix | 1 + modules/config/instances/config/matrix.nix | 1 + modules/config/instances/config/nextcloud.nix | 1 + modules/config/instances/config/ollama.nix | 1 + modules/config/instances/config/opencloud.nix | 1 + modules/config/instances/config/owncast.nix | 1 + modules/config/instances/config/peertube.nix | 1 + modules/config/instances/config/searx.nix | 1 + modules/config/instances/config/syncthing.nix | 1 + modules/config/instances/config/synology.nix | 1 + .../instances/config/upRootNutrition.nix | 1 + .../config/instances/config/vaultwarden.nix | 1 + modules/config/instances/config/web.nix | 4 +- .../bookmarks/config/flake/selfHosted.nix | 179 +++++++----------- modules/nixos/services/jellyfin/default.nix | 2 +- 20 files changed, 87 insertions(+), 119 deletions(-) diff --git a/modules/config/default.nix b/modules/config/default.nix index 746948e..c4665a3 100755 --- a/modules/config/default.nix +++ b/modules/config/default.nix @@ -56,6 +56,7 @@ let subdomain = stringType; label = stringType; name = stringType; + short = stringType; hostname = stringType; tags = listType; domains = genOptions stringType "url"; diff --git a/modules/config/instances/config/audiobookshelf.nix b/modules/config/instances/config/audiobookshelf.nix index b548863..71d11d3 100755 --- a/modules/config/instances/config/audiobookshelf.nix +++ b/modules/config/instances/config/audiobookshelf.nix @@ -14,6 +14,7 @@ in { label = audiobookshelfLabel; name = audiobookshelfName; + short = "Books"; sops = { path0 = "${sopsPath}/${audiobookshelfName}"; }; diff --git a/modules/config/instances/config/forgejo.nix b/modules/config/instances/config/forgejo.nix index d769152..d9f84a2 100755 --- a/modules/config/instances/config/forgejo.nix +++ b/modules/config/instances/config/forgejo.nix @@ -15,6 +15,7 @@ in { label = label; name = name; + short = label; email = { address0 = "noreply@${domain3}"; }; diff --git a/modules/config/instances/config/glance.nix b/modules/config/instances/config/glance.nix index 9d76723..1bf45de 100755 --- a/modules/config/instances/config/glance.nix +++ b/modules/config/instances/config/glance.nix @@ -15,6 +15,7 @@ in { label = label; name = name; + short = label; email = { address0 = "noreply@${domain0}"; }; diff --git a/modules/config/instances/config/jellyfin.nix b/modules/config/instances/config/jellyfin.nix index 31c1b48..e002298 100755 --- a/modules/config/instances/config/jellyfin.nix +++ b/modules/config/instances/config/jellyfin.nix @@ -13,6 +13,7 @@ in { label = label; name = name; + short = "Jelly"; sops = { path0 = "${sopsPath}/${name}"; }; @@ -33,8 +34,8 @@ in path1 = "${servicePath}/${label}/cache"; }; ports = { - port0 = 5055; # Jellyseer - port1 = 8096; # Jellyfin HTTP + port0 = 8096; # Jellyfin HTTP + port1 = 5055; # Jellyseer port2 = 8920; # Jellyfin HTTPS }; ssl = { diff --git a/modules/config/instances/config/mastodon.nix b/modules/config/instances/config/mastodon.nix index cf7095a..639d4a3 100755 --- a/modules/config/instances/config/mastodon.nix +++ b/modules/config/instances/config/mastodon.nix @@ -15,6 +15,7 @@ in { label = label; name = name; + short = "Mast"; email = { address0 = "noreply@${domain3}"; }; diff --git a/modules/config/instances/config/matrix.nix b/modules/config/instances/config/matrix.nix index a3efe24..aa26cce 100755 --- a/modules/config/instances/config/matrix.nix +++ b/modules/config/instances/config/matrix.nix @@ -11,6 +11,7 @@ in { label = label; name = name; + short = label; sops = { path0 = "${sopsPath}/${name}"; }; diff --git a/modules/config/instances/config/nextcloud.nix b/modules/config/instances/config/nextcloud.nix index 233a213..cf5c873 100755 --- a/modules/config/instances/config/nextcloud.nix +++ b/modules/config/instances/config/nextcloud.nix @@ -14,6 +14,7 @@ in { label = label; name = name; + short = "Next"; email = { address0 = "noreply@${name}.${domain0}"; }; diff --git a/modules/config/instances/config/ollama.nix b/modules/config/instances/config/ollama.nix index 643f7ab..4e463f0 100755 --- a/modules/config/instances/config/ollama.nix +++ b/modules/config/instances/config/ollama.nix @@ -14,6 +14,7 @@ in { label = label; name = name; + short = label; sops = { path0 = "${sopsPath}/${name}"; }; diff --git a/modules/config/instances/config/opencloud.nix b/modules/config/instances/config/opencloud.nix index 179a3d0..530313f 100755 --- a/modules/config/instances/config/opencloud.nix +++ b/modules/config/instances/config/opencloud.nix @@ -15,6 +15,7 @@ in { label = label; name = name; + short = "Cloud"; email = { address0 = "noreply@${domain0}"; }; diff --git a/modules/config/instances/config/owncast.nix b/modules/config/instances/config/owncast.nix index 5d7f072..41d692d 100755 --- a/modules/config/instances/config/owncast.nix +++ b/modules/config/instances/config/owncast.nix @@ -15,6 +15,7 @@ in { label = label; name = name; + short = "Cast"; sops = { path0 = "${sopsPath}/${name}"; }; diff --git a/modules/config/instances/config/peertube.nix b/modules/config/instances/config/peertube.nix index 93b0a73..e5c3018 100755 --- a/modules/config/instances/config/peertube.nix +++ b/modules/config/instances/config/peertube.nix @@ -15,6 +15,7 @@ in { label = label; name = name; + short = "Peer"; email = { address0 = "noreply@${domain3}"; }; diff --git a/modules/config/instances/config/searx.nix b/modules/config/instances/config/searx.nix index 087f75b..50579ce 100755 --- a/modules/config/instances/config/searx.nix +++ b/modules/config/instances/config/searx.nix @@ -15,6 +15,7 @@ in { label = label; name = name; + short = "Sear"; email = { address0 = "noreply@${domain0}"; }; diff --git a/modules/config/instances/config/syncthing.nix b/modules/config/instances/config/syncthing.nix index 22badb1..db583c0 100755 --- a/modules/config/instances/config/syncthing.nix +++ b/modules/config/instances/config/syncthing.nix @@ -14,6 +14,7 @@ in { label = label; name = name; + short = "Sync"; sops = { path0 = "${sopsPath}/${name}"; }; diff --git a/modules/config/instances/config/synology.nix b/modules/config/instances/config/synology.nix index 0af590d..b4ee41e 100755 --- a/modules/config/instances/config/synology.nix +++ b/modules/config/instances/config/synology.nix @@ -11,6 +11,7 @@ in { label = label; name = name; + short = "Nas"; tags = [ name "dsm" diff --git a/modules/config/instances/config/upRootNutrition.nix b/modules/config/instances/config/upRootNutrition.nix index 5748123..2531f51 100755 --- a/modules/config/instances/config/upRootNutrition.nix +++ b/modules/config/instances/config/upRootNutrition.nix @@ -12,6 +12,7 @@ in { label = label; name = name; + short = "upRoot"; email = { address0 = "nick@${domain3}"; }; diff --git a/modules/config/instances/config/vaultwarden.nix b/modules/config/instances/config/vaultwarden.nix index a2bf140..f1400ac 100755 --- a/modules/config/instances/config/vaultwarden.nix +++ b/modules/config/instances/config/vaultwarden.nix @@ -14,6 +14,7 @@ in { label = label; name = name; + short = "Vault"; email = { address0 = "noreply@${name}.${domain0}"; }; diff --git a/modules/config/instances/config/web.nix b/modules/config/instances/config/web.nix index beedbf9..f725831 100755 --- a/modules/config/instances/config/web.nix +++ b/modules/config/instances/config/web.nix @@ -6,10 +6,12 @@ let domain2 domain3 ; + label = "Router"; in { + label = label; name = "router"; - label = "Router"; + short = label; domains = { url0 = domain0; url1 = domain1; diff --git a/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/flake/selfHosted.nix b/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/flake/selfHosted.nix index 48f7fe3..e0171cd 100755 --- a/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/flake/selfHosted.nix +++ b/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/flake/selfHosted.nix @@ -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; } diff --git a/modules/nixos/services/jellyfin/default.nix b/modules/nixos/services/jellyfin/default.nix index c4ade14..37720a7 100755 --- a/modules/nixos/services/jellyfin/default.nix +++ b/modules/nixos/services/jellyfin/default.nix @@ -25,7 +25,7 @@ in redir /.well-known/carddav /remote.php/dav/ 301 redir /.well-known/caldav /remote.php/dav/ 301 - reverse_proxy ${localhost}:${toString service.ports.port1} + reverse_proxy ${localhost}:${toString service.ports.port0} tls ${service.ssl.cert} ${service.ssl.key} ''; From 480a6f4775a5e58563f4a2f3f2904c1e627dc709 Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 7 Jul 2025 20:34:31 -0500 Subject: [PATCH 2/2] refactor: abstracting out bookmark info --- .../config/bookmarks/config/development.nix | 21 ++++ .../bookmarks/config/flake/selfHosted.nix | 113 ++++++++---------- 2 files changed, 69 insertions(+), 65 deletions(-) diff --git a/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/development.nix b/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/development.nix index d428930..f7ba28a 100755 --- a/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/development.nix +++ b/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/development.nix @@ -84,5 +84,26 @@ in ]; keyword = "Hack"; } + { + name = "Elm-Land Server"; + url = "http://localhost:1234"; + tags = [ + "elm-land" + "elm" + "land" + ]; + keyword = "Website"; + } + { + name = "Namecheap"; + url = "https://www.namecheap.com"; + tags = [ + "namecheap" + "name" + "cheap" + "dns" + ]; + keyword = "Name"; + } ]; } diff --git a/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/flake/selfHosted.nix b/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/flake/selfHosted.nix index e0171cd..3f4d85f 100755 --- a/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/flake/selfHosted.nix +++ b/modules/home/gui/apps/browsers/floorp/config/bookmarks/config/flake/selfHosted.nix @@ -22,77 +22,60 @@ let 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" - ]; - } - ]; + bookmarkConfigs = + let + port = name: toString instances.${name}.ports.port0; + in + [ + { + suffix = "(Remote)"; + urlTemplate = name: "https://${instances.${name}.domains.url0}"; + services = [ + "audiobookshelf" + "forgejo" + "glance" + "jellyfin" + "mastodon" + "ollama" + "opencloud" + "owncast" + "peertube" + "searx" + "vaultwarden" + ]; + } + { + suffix = "(Desktop)"; + urlTemplate = "http://${mars.ip.address0}:${port}"; + services = [ + "ollama" + "syncthing" + ]; + } + { + suffix = "(Server)"; + urlTemplate = "http://${ceres.ip.address0}:${port}"; + services = [ + "jellyfin" + ]; + } + { + suffix = "(Synology)"; + urlTemplate = "http://${synology.ip.address0}:${port}"; + services = [ + "syncthing" + ]; + } + ]; generatedBookmarks = builtins.concatLists (builtins.map makeBookmarks bookmarkConfigs); flatBookmarks = [ { - name = "Elm-Land Server"; - url = "http://localhost:1234"; - tags = [ - "elm-land" - "elm" - "land" - ]; - keyword = "Website"; - } - { - name = "Namecheap"; - url = "https://www.namecheap.com"; - tags = [ - "namecheap" - "name" - "cheap" - "dns" - ]; - keyword = "Name"; - } - { - name = "Router"; + name = instances.web.label; url = "http://${instances.web.localhost.address2}"; - tags = [ ]; - keyword = "Router"; + tags = instances.web.tags; + keyword = instances.web.label; } ]; in