{ 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" = { style = "row"; columns = 2; }; "Piracy" = { style = "row"; columns = 4; }; "Other" = { 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; } ]; } ]; }; nginx.virtualHosts."${cfg.host}" = lib.mkIf cfg.enableProxy ( proxyReverse cfg.hostName cfg.port // { } ); }; }; }