From 5867c079463abbe834b518b89665823decf39924 Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Fri, 1 Nov 2024 20:29:50 +0530 Subject: [PATCH] rico2: setup a homepage --- hosts/rico2/services/apps/default.nix | 2 +- hosts/rico2/services/apps/homepage.nix | 95 +++++++++++++++++++ .../rico2/services/apps/homepage/default.nix | 27 ------ 3 files changed, 96 insertions(+), 28 deletions(-) create mode 100644 hosts/rico2/services/apps/homepage.nix delete mode 100644 hosts/rico2/services/apps/homepage/default.nix diff --git a/hosts/rico2/services/apps/default.nix b/hosts/rico2/services/apps/default.nix index b5d31b9..04db460 100644 --- a/hosts/rico2/services/apps/default.nix +++ b/hosts/rico2/services/apps/default.nix @@ -4,7 +4,7 @@ _: { ./blocky.nix ./forgejo-actions-runner.nix ./grafana.nix - ./homepage + ./homepage.nix ../../../shared/prometheus-exporters.nix ../../../shared/promtail.nix ]; diff --git a/hosts/rico2/services/apps/homepage.nix b/hosts/rico2/services/apps/homepage.nix new file mode 100644 index 0000000..ef70f43 --- /dev/null +++ b/hosts/rico2/services/apps/homepage.nix @@ -0,0 +1,95 @@ +{ config, ... }: +let + inherit (import ../../../shared/caddy-helpers.nix) logFormat; + domainName = "homepage.labs.adtya.xyz"; + cfg = config.services.glance; +in +{ + services = { + caddy = { + virtualHosts."${domainName}" = { + inherit logFormat; + extraConfig = '' + reverse_proxy ${cfg.settings.server.host}:${toString cfg.settings.server.port} + ''; + }; + }; + glance = { + enable = true; + settings = { + server = { + host = "127.0.0.1"; + port = 5678; + }; + theme = { + background-color = "240 21 15"; + contrast-multiplier = 1.2; + primary-color = "217 92 83"; + positive-color = "115 54 76"; + negative-color = "347 70 65"; + }; + pages = [ + { + name = "Startpage"; + width = "slim"; + hide-desktop-navigation = true; + center-vertically = true; + columns = [ + { + size = "full"; + widgets = [ + { + type = "search"; + autofocus = true; + search-engine = "duckduckgo"; + bangs = [ + { title = "YouTube"; shortcut = "!yt"; url = "https://www.youtube.com/results?search_query={QUERY}"; } + { title = "NixOS Options"; shortcut = "!no"; url = "https://search.nixos.org/options?channel=unstable&query={QUERY}"; } + { title = "Nix Packages"; shortcut = "!np"; url = "https://search.nixos.org/packages?channel=unstable&query={QUERY}"; } + { title = "GitHub"; shortcut = "!gh"; url = "https://github.com/search?q={QUERY}&type=repositories"; } + { title = "DockerHub"; shortcut = "!docker"; url = "https://hub.docker.com/search?q={QUERY}";} + ]; + } + { + type = "monitor"; + cache = "1m"; + title = "Services"; + sites = [ + { title = "Jellyfin"; url = "https://jellyfin.labs.adtya.xyz/"; icon = "si:jellyfin"; } + { title = "Forgejo"; url = "https://forge.acomputer.lol/"; icon = "si:forgejo"; } + { title = "Transmission"; url = "https://transmission.labs.adtya.xyz/"; icon = "si:transmission"; } + { title = "Lidarr"; url = "https://lidarr.labs.adtya.xyz/"; icon = "si:lidarr"; } + { title = "Radarr"; url = "https://radarr.labs.adtya.xyz/"; icon = "si:radarr"; } + { title = "Sonarr"; url = "https://sonarr.labs.adtya.xyz/"; icon = "si:sonarr"; } + { title = "Prowlarr"; url = "https://prowlarr.labs.adtya.xyz/"; icon = "si:prowlarr"; } + ]; + } + + { + type = "bookmarks"; + groups = [ + { + title = "Homelab"; + links = [ + { title = "Grafana"; url = "https://grafana.labs.adtya.xyz/"; } + { title = "Prometheus"; url = "https://prometheus.labs.adtya.xyz/"; } + { title = "Alert Manager"; url = "https://alertmanager.labs.adtya.xyz/"; } + ]; + } + { + title = "General"; + links = [ + { title = "Email"; url = "https://app.fastmail.com/mail/Inbox/"; } + ]; + } + ]; + } + ]; + } + ]; + } + ]; + }; + }; + }; +} diff --git a/hosts/rico2/services/apps/homepage/default.nix b/hosts/rico2/services/apps/homepage/default.nix deleted file mode 100644 index 7cc27c9..0000000 --- a/hosts/rico2/services/apps/homepage/default.nix +++ /dev/null @@ -1,27 +0,0 @@ -{config, ...}: -let - inherit (import ../../../shared/caddy-helpers.nix) logFormat; - domainName = "homepage.labs.adtya.xyz"; - cfg = config.services.glance; -in -{ - services = { - caddy = { - virtualHosts."${domainName}" = { - inherit logFormat; - extraConfig = '' - reverse_proxy ${cfg.settings.server.host}:${cfg.settings.server.port} - ''; - }; - }; - glance = { - enable = true; - settings = { - server = { - host = "127.0.0.1"; - port = "5678"; - }; - }; - }; - }; -}