rico2: replace homer with glance

This commit is contained in:
Adithya 2024-11-01 10:22:52 +05:30
parent 95f35cfdf6
commit 61c055ae24
Signed by: adtya
GPG key ID: B8857BFBA2C47B9C
4 changed files with 28 additions and 58 deletions

View file

@ -4,7 +4,7 @@ _: {
./blocky.nix
./forgejo-actions-runner.nix
./grafana.nix
./homer
./homepage
../../../shared/prometheus-exporters.nix
../../../shared/promtail.nix
];

View file

@ -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";
};
};
};
};
}

View file

@ -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
}
'';
};
};
};
}

View file

@ -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 ];
};
}