From bca8a78af95ca2103859313c9c463de018b4cee2 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Tue, 22 Apr 2025 18:34:34 +0200 Subject: [PATCH] morn: configure glance --- hosts/morn/configuration.nix | 3 + hosts/morn/services/glance/default.nix | 15 +++++ hosts/morn/services/glance/settings.nix | 83 +++++++++++++++++++++++++ hosts/morn/services/nginx.nix | 19 ++++++ 4 files changed, 120 insertions(+) create mode 100644 hosts/morn/services/glance/default.nix create mode 100644 hosts/morn/services/glance/settings.nix create mode 100644 hosts/morn/services/nginx.nix diff --git a/hosts/morn/configuration.nix b/hosts/morn/configuration.nix index 1f2871c..c9f996d 100644 --- a/hosts/morn/configuration.nix +++ b/hosts/morn/configuration.nix @@ -7,6 +7,9 @@ ../../common/metrics-exporters.nix ../../common/auto-upgrade.nix ./hardware-configuration.nix + + ./services/nginx.nix + ./services/glance ]; networking = { diff --git a/hosts/morn/services/glance/default.nix b/hosts/morn/services/glance/default.nix new file mode 100644 index 0000000..0cf7dd9 --- /dev/null +++ b/hosts/morn/services/glance/default.nix @@ -0,0 +1,15 @@ +{ config, values, ... }: +{ + services.glance = { + enable = true; + settings = import ./settings.nix; + }; + + services.nginx.virtualHosts."glance.home.feal.no" = let + inherit (config.services.glance.settings.server) host port; + in { + locations."/" = { + proxyPass = "http://${host}:${toString port}"; + }; + }; +} diff --git a/hosts/morn/services/glance/settings.nix b/hosts/morn/services/glance/settings.nix new file mode 100644 index 0000000..d4d537b --- /dev/null +++ b/hosts/morn/services/glance/settings.nix @@ -0,0 +1,83 @@ +{ config, ... }: + +{ + server = { + port = 5001; + host = "127.0.1.2"; + }; + + pages = + let + fullCol = widgets: { + size = "full"; + inherit widgets; + }; + in + [ + { + name = "Home"; + columns = [ + (fullCol [ + { + type = "search"; + search-engine = "http://search.home.feal.no/search?q={QUERY}"; + } + { + type = "weather"; + units = "metric"; + location = "Trondheim, Norway"; + } + ]) + (fullCol [ + { + type = "hacker-news"; + limit = 20; + collapse-after = 5; + } + { + type = "monitor"; + cache = "5m"; + sites = + let + site = title: url: { inherit title url; }; + in + [ + (site "Jellyfin" "http://jellyfin.home.feal.no") + (site "Gitea" "https://git.feal.no") + (site "VaultWarden" "https://pw.feal.no") + ]; + } + ]) + ]; + } + + { + name = "News"; + columns = + let + feed = title: url: { inherit title url; }; + rss = title: feeds: { + type = "rss"; + inherit title feeds; + }; + in + [ + (fullCol [ + (rss "Norway" [ + (feed "NRK" "https://www.nrk.no/toppsaker.rss") + (feed "Bygdeposten" "https://www.bygdeposten.no/service/rss") + (feed "Nidaros" "https://www.nidaros.no/service/rss") + ]) + ]) + + (fullCol [ + (rss "NTNU" [ + (feed "OmegaV" "https://omegav.no/newsrss") + (feed "PVV" "https://www.pvv.ntnu.no/w/api.php?hidebots=1&urlversion=1&days=7&limit=50&action=feedrecentchanges&feedformat=atom") + (feed "IT-Varsel" "https://varsel.it.ntnu.no/subscribe/rss/") + ]) + ]) + ]; + } + ]; +} diff --git a/hosts/morn/services/nginx.nix b/hosts/morn/services/nginx.nix new file mode 100644 index 0000000..e4f4a00 --- /dev/null +++ b/hosts/morn/services/nginx.nix @@ -0,0 +1,19 @@ +{ config, values, ... }: +{ + services.nginx = { + enable = true; + enableReload = true; + + recommendedProxySettings = true; + recommendedTlsSettings = true; + recommendedGzipSettings = true; + recommendedOptimisation = true; + }; + + networking.firewall.allowedTCPPorts = [ 80 443 ]; + + security.acme = { + acceptTerms = true; + defaults.email = "felix@albrigtsen.it"; + }; +}