{ lib, config, proxyReverse, setup, ... }: let services = import ./homepage/services.nix { inherit config lib; }; cfg = config.my.servers.homepage; in { options.my.servers.homepage = setup.mkOptions "homepage" "home" 8082; config = { networking.firewall.allowedTCPPorts = lib.mkIf (!cfg.isLocal) [ cfg.port ]; sops.secrets = lib.mkIf cfg.enable { homepage.sopsFile = ../../secrets/env.yaml; }; services = { homepage-dashboard = lib.mkIf cfg.enable { enable = true; listenPort = cfg.port; environmentFile = config.sops.secrets.homepage.path; settings = { layout = { "multimedia" = { tab = "servers"; style = "row"; columns = 2; }; "piracy" = { tab = "servers"; style = "row"; columns = 4; }; "other" = { tab = "chichis"; style = "row"; columns = 3; }; }; background = "https://images.unsplash.com/photo-1502790671504-542ad42d5189?auto=format&fit=crop&w=2560&q=80"; }; widgets = [ { resources = { cpu = true; cputemp = true; units = "metric"; disk = "/"; memory = true; }; } { search = { provider = [ "brave" "bing" "google" ]; target = "_blank"; showSearchSuggestions = true; }; } ]; services = [ { "Multimedia" = [ { inherit (services) jellyfin; } { inherit (services) audiobookshelf; } { inherit (services) "now playing"; } { inherit (services) kavita; } ]; } { "Piracy" = [ { inherit (services) sonarr; } { inherit (services) radarr; } { inherit (services) lidarr; } { inherit (services) bazarr; } { inherit (services) prowlarr; } { inherit (services) sabnzbd; } { inherit (services) "qbittorrent server"; } { inherit (services) "qbittorrent miniserver"; } ]; } { "Other" = [ { inherit (services) mealie; } { inherit (services) nextcloud; } { inherit (services) paperless; } ]; } ]; bookmarks = [ { servers = [ { shiori = [ { abbr = "SH"; href = "https://bookmarks.servidos.lat/"; } ]; maloja = [ { abbr = "ML"; href = "https://maloja.servidos.lat/"; } ]; microbin = [ { abbr = "CP"; href = "https://copy.servidos.lat/"; } ]; multi-scrobbpler = [ { abbr = "MS"; href = "https://scrobble.servidos.lat/"; } ]; ryot = [ { abbr = "RT"; href = "https://tracker.servidos.lat/"; } ]; vaultwarden = [ { abbr = "VW"; href = "https://vault.servidos.lat"; } ]; } ]; } ]; }; nginx.virtualHosts."${cfg.host}" = lib.mkIf cfg.enableProxy ( proxyReverse cfg.hostName cfg.port // { } ); }; }; }