From 61c055ae247cffcaf798faa5181dbe202b6ea817 Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Fri, 1 Nov 2024 10:22:52 +0530 Subject: [PATCH] rico2: replace homer with glance --- hosts/rico2/services/apps/default.nix | 2 +- .../rico2/services/apps/homepage/default.nix | 27 +++++++++++++++ hosts/rico2/services/apps/homer/default.nix | 23 ------------- hosts/rico2/services/apps/homer/package.nix | 34 ------------------- 4 files changed, 28 insertions(+), 58 deletions(-) create mode 100644 hosts/rico2/services/apps/homepage/default.nix delete mode 100644 hosts/rico2/services/apps/homer/default.nix delete mode 100644 hosts/rico2/services/apps/homer/package.nix diff --git a/hosts/rico2/services/apps/default.nix b/hosts/rico2/services/apps/default.nix index 78cb293..b5d31b9 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 - ./homer + ./homepage ../../../shared/prometheus-exporters.nix ../../../shared/promtail.nix ]; diff --git a/hosts/rico2/services/apps/homepage/default.nix b/hosts/rico2/services/apps/homepage/default.nix new file mode 100644 index 0000000..7cc27c9 --- /dev/null +++ b/hosts/rico2/services/apps/homepage/default.nix @@ -0,0 +1,27 @@ +{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"; + }; + }; + }; + }; +} diff --git a/hosts/rico2/services/apps/homer/default.nix b/hosts/rico2/services/apps/homer/default.nix deleted file mode 100644 index 30c8436..0000000 --- a/hosts/rico2/services/apps/homer/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ pkgs, ... }: -let - inherit (import ../../../../shared/caddy-helpers.nix) logFormat; - domainName = "homepage.labs.adtya.xyz"; - homerPackage = pkgs.callPackage ./package.nix { }; -in -{ - services = { - caddy = { - virtualHosts."${domainName}" = { - inherit logFormat; - extraConfig = '' - handle { - root * ${homerPackage}/share/web - encode gzip - try_files {path} /index.html - file_server - } - ''; - }; - }; - }; -} diff --git a/hosts/rico2/services/apps/homer/package.nix b/hosts/rico2/services/apps/homer/package.nix deleted file mode 100644 index a3819e8..0000000 --- a/hosts/rico2/services/apps/homer/package.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ lib, stdenvNoCC, fetchzip, configuration ? null, styleSheet ? null }: -stdenvNoCC.mkDerivation rec { - name = "homer"; - version = "v24.10.2"; - - src = fetchzip { - url = "https://github.com/bastienwirtz/homer/releases/download/v24.10.2/homer.zip"; - sha256 = "sha256-V4E/KLOzfiCMwdQrXzab2VzjuB0TYpocoYhdUVt4g78="; - stripRoot = false; - }; - - sourceRoot = "${src.name}/"; - - configFile = - if configuration != null - then (lib.generators.toYAML { } (configuration // { stylesheet = "assets/custom.css"; })) - else "${src}/assets/config-demo.yml.dist"; - - installPhase = '' - mkdir -p $out/share/web - cp -r ./* $out/share/web/ - rm $out/share/web/assets/*.dist $out/share/web/*.sample - cp ${configFile} $out/share/web/assets/config.yml - ${lib.optionalString (styleSheet != null) "cp ${styleSheet} $out/share/web/assets/custom.css"} - ''; - - meta = { - homepage = "https://github.com/bastienwirtz/homer"; - description = "A very simple static homepage for your server"; - license = lib.licenses.asl20; - platforms = lib.platforms.all; - maintainers = with lib.maintainers; [ adtya ]; - }; -}