rico2: setup a homepage with homer

This commit is contained in:
Adithya 2024-10-31 15:57:16 +05:30
parent fb13e6c63a
commit 9a98ad138b
Signed by: adtya
GPG key ID: B8857BFBA2C47B9C
5 changed files with 62 additions and 1 deletions

View file

@ -53,10 +53,12 @@ in
Locked = true;
};
Homepage = {
StartPage = "previous-session";
URL = "https://homepage.labs.adtya.xyz";
StartPage = "homepage-locked";
Locked = true;
};
NetworkPrediction = false;
NewTabPage = false;
NoDefaultBookmarks = true;
OfferToSaveLogins = false;
OverrideFirstRunPage = "";

View file

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

View file

@ -0,0 +1,23 @@
{ 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

@ -0,0 +1,34 @@
{ 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 ];
};
}

View file

@ -69,6 +69,7 @@
"blocky.rico1.labs.adtya.xyz" = "10.10.10.11";
"blocky.rico2.labs.adtya.xyz" = "10.10.10.12";
"grafana.labs.adtya.xyz" = "10.10.10.12";
"homepage.labs.adtya.xyz" = "10.10.10.12";
"jackett.labs.adtya.xyz" = "10.10.10.14";
"jellyfin.labs.adtya.xyz" = "10.10.10.14";
"loki.labs.adtya.xyz" = "10.10.10.11";