import favicons into all **.ily.rs sites

This commit is contained in:
Lewis Wynne 2026-04-29 18:17:56 +01:00
parent 4699453cf6
commit 554a268369
11 changed files with 45 additions and 0 deletions

BIN
assets/favicons/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -0,0 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.0" viewBox="0 0 264 264"><path d="M137.6 47.3c-6.7-.5-7.4-.3-12 2.8-3 2-6.4 5.6-8.7 9.2-2.1 3.2-4.8 8.4-5.9 11.5-1.2 3.1-3.2 10.6-4.5 16.6-1.2 6.1-3 19.4-4 29.6-1.4 16.3-1.9 18.8-3.8 20.9-1.2 1.3-6.2 5.5-11.1 9.2-4.9 3.8-11.6 8.5-15 10.4-3.3 1.8-8.5 4.3-11.5 5.5-3 1.1-5.7 1.7-6.1 1.3s-1-2.4-1.4-4.3c-.5-3.2.1-4.4 6.9-13.8 4.1-5.7 9.9-15.4 12.9-21.5 3-6.2 6.4-14 7.5-17.5 1.2-3.4 2.6-9.4 3.1-13.2.6-4.4.6-8.7 0-11.9-.5-2.8-2.1-7.4-3.6-10.2-1.4-2.9-4.9-7.7-7.7-10.7-2.9-2.9-7-6.4-9.2-7.7s-5.9-2.8-8.2-3.3c-2.7-.6-5.9-.6-8.5 0-2.4.5-5.6 2.1-7.1 3.6-1.6 1.5-3.7 4.3-4.7 6.3-1 1.9-2.5 6.2-3.4 9.5-.8 3.2-2.7 14-4.1 23.9-2.2 15.2-2.6 20.9-2.4 36.9.3 18.9.3 18.9-3.7 22.8-2.1 2.1-5.7 4.9-7.8 6.1-2.2 1.2-4.9 3.5-6 5-1.4 1.9-2.1 4.4-2.1 7.4 0 3.9.5 4.9 3.7 7.9 3.3 3 4.4 3.4 8.9 3.4 3.8 0 6.4-.7 9.8-2.7 3-1.8 4.6-2.2 4.9-1.4.2.6 1.6 2.6 3 4.3s4.4 3.9 6.7 4.9c2.6 1.2 6.4 1.9 11.1 1.9 4.4 0 9.2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4-2.1 0-3.8-.4-3.8-.9 0-.6.4-1.2.9-1.5.5-.4 2.4-4.1 4.1-8.3 1.8-4.2 4.5-14 6.1-21.7 1.6-7.6 2.9-16.1 2.9-18.8 0-4.1-.5-5.4-3.3-8.4-2.6-2.8-4.2-3.7-7.7-4.1-3.4-.3-5.3.1-7.8 1.6-1.8 1.2-4.1 4-5.2 6.3-1.1 2.4-4.6 11.7-7.9 20.8-3.2 9.1-6.2 18.4-6.6 20.8-.4 2.8-1.7 5.3-3.8 7.4-1.8 1.7-5.2 4-7.7 5.2-3.1 1.4-6.6 2-11.5 2.1-5.5 0-8.1-.5-12-2.5-3.8-1.9-4.9-3-4.7-4.4.2-1.1 3.3-5.1 6.8-9 3.6-3.8 8.7-9.9 11.4-13.5 2.8-3.6 6.7-10.2 8.9-14.6 2.1-4.5 5-11.4 6.3-15.5 1.9-6.3 2.3-9.7 2.3-20.6 0-12.8-.1-13.2-3-17.9-2.1-3.3-4.7-5.7-8.4-7.8-4.1-2.4-6.9-3.1-12.5-3.4m-.8 29.6c.2.6-.2 4.2-.8 7.9s-2.2 8.9-3.5 11.7c-1.4 3.1-2.4 4.2-2.4 3-.1-1.1.8-5.6 1.9-10.1 1-4.4 2.5-9.3 3.2-10.8.7-1.6 1.4-2.3 1.6-1.7M55.6 80c.2 0 1.1 1.4 2 3.2q1.65 3.15 1.2 7.8c-.3 2.6-2 8.7-3.9 13.5-2.4 6.1-3.5 8-3.7 6.5-.2-1.3.3-7.5 1.2-13.9s1.9-12.8 2.2-14.4c.3-1.5.7-2.7 1-2.7"/>
<style>
path {
fill: black;
}
@media (prefers-color-scheme: dark) {
path {
fill: pink;
}
}
</style></svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -6,6 +6,7 @@
./foundry.nix ./foundry.nix
./dokuwiki.nix ./dokuwiki.nix
./forgejo.nix ./forgejo.nix
../../modules/favicons.nix
../../modules/site.nix ../../modules/site.nix
./sites.nix ./sites.nix
./fail2ban.nix ./fail2ban.nix

View file

@ -18,6 +18,8 @@ in
{ {
services.caddy.virtualHosts."wiki.ily.rs" = { services.caddy.virtualHosts."wiki.ily.rs" = {
extraConfig = '' extraConfig = ''
import favicons
@health path /health-ping @health path /health-ping
handle @health { handle @health {
respond 200 respond 200

View file

@ -11,6 +11,7 @@ in
services.caddy.virtualHosts."git.ily.rs" = { services.caddy.virtualHosts."git.ily.rs" = {
extraConfig = '' extraConfig = ''
import favicons
reverse_proxy localhost:${toString srv.HTTP_PORT} reverse_proxy localhost:${toString srv.HTTP_PORT}
encode zstd gzip encode zstd gzip
''; '';

View file

@ -2,6 +2,7 @@
{ {
services.caddy.virtualHosts."foundry.ily.rs" = { services.caddy.virtualHosts."foundry.ily.rs" = {
extraConfig = '' extraConfig = ''
import favicons
reverse_proxy localhost:30000 reverse_proxy localhost:30000
encode zstd gzip encode zstd gzip
''; '';

View file

@ -40,6 +40,8 @@
services.caddy.virtualHosts."links.ily.rs" = { services.caddy.virtualHosts."links.ily.rs" = {
extraConfig = '' extraConfig = ''
import favicons
@health path /health-ping @health path /health-ping
handle @health { handle @health {
respond 200 respond 200

View file

@ -49,6 +49,8 @@ in
# (light_theme/dark_theme/extra_themes) needs 0.22+. Pull from unstable. # (light_theme/dark_theme/extra_themes) needs 0.22+. Pull from unstable.
extraBuildPackages = [ unstable.zola ]; extraBuildPackages = [ unstable.zola ];
caddyConfig = '' caddyConfig = ''
import favicons
root * /srv/website/repo/public root * /srv/website/repo/public
encode zstd gzip encode zstd gzip

View file

@ -16,6 +16,7 @@
services.caddy.virtualHosts."auth.ily.rs" = { services.caddy.virtualHosts."auth.ily.rs" = {
extraConfig = '' extraConfig = ''
import favicons
reverse_proxy localhost:3002 reverse_proxy localhost:3002
encode zstd gzip encode zstd gzip
''; '';

18
modules/favicons.nix Normal file
View file

@ -0,0 +1,18 @@
{ ... }:
let
faviconRoot = ../assets/favicons;
in
{
services.caddy.extraConfig = ''
(favicons) {
@favicon path /favicon.ico /favicon.svg /favicon.png /apple-touch-icon.png /apple-touch-icon-precomposed.png
handle @favicon {
root * ${faviconRoot}
@needs_png path /favicon.ico /apple-touch-icon.png /apple-touch-icon-precomposed.png
rewrite @needs_png /favicon.png
header Cache-Control "public, max-age=86400"
file_server
}
}
'';
}

View file

@ -176,11 +176,13 @@ in
${site.domain}.extraConfig = ${site.domain}.extraConfig =
if site.caddyConfig != null then site.caddyConfig if site.caddyConfig != null then site.caddyConfig
else if site.static then '' else if site.static then ''
import favicons
root * ${site.dataDir}/repo/${site.buildOutputDir} root * ${site.dataDir}/repo/${site.buildOutputDir}
encode zstd gzip encode zstd gzip
try_files {path} /index.html try_files {path} /index.html
file_server file_server
'' else '' '' else ''
import favicons
reverse_proxy localhost:${toString site.port} reverse_proxy localhost:${toString site.port}
encode zstd gzip encode zstd gzip
''; '';
@ -193,6 +195,8 @@ in
) cfg) ++ (mapAttrsToList (name: site: ) cfg) ++ (mapAttrsToList (name: site:
let previewDataDir = "/srv/${name}-preview"; in { let previewDataDir = "/srv/${name}-preview"; in {
${site.preview.domain}.extraConfig = if site.static then '' ${site.preview.domain}.extraConfig = if site.static then ''
import favicons
@health path /health-ping @health path /health-ping
handle @health { handle @health {
respond 200 respond 200
@ -205,6 +209,8 @@ in
file_server file_server
} }
'' else '' '' else ''
import favicons
@health path /health-ping @health path /health-ping
handle @health { handle @health {
respond 200 respond 200