diff --git a/nix-system-configs/modules/styling/forgejo/header.tmpl b/nix-system-configs/modules/styling/forgejo/header.tmpl new file mode 100644 index 0000000..241df9e --- /dev/null +++ b/nix-system-configs/modules/styling/forgejo/header.tmpl @@ -0,0 +1,2 @@ +{{/* This will be injected into
via $FORGEJO_CUSTOM/templates/custom/header.tmpl */}} + diff --git a/nix-system-configs/modules/styling/forgejo/theme-custom.css b/nix-system-configs/modules/styling/forgejo/theme-custom.css index 634f6ad..7c12ccd 100644 --- a/nix-system-configs/modules/styling/forgejo/theme-custom.css +++ b/nix-system-configs/modules/styling/forgejo/theme-custom.css @@ -1,3 +1,5 @@ +@import "./theme-forgejo-auto.css"; + @font-face { font-family: 'Maple Mono NF'; src: url('/assets/fonts/MapleMonoNerd.ttf') format('truetype'); @@ -6,11 +8,7 @@ font-display: swap; } -/* import base Forgejo theme so we only override what we need */ -@import "./theme-forgejo-auto.css"; - :root { /* prefer the Maple Mono Nerd Font for monospace usage */ --fonts-monospace: 'Maple Mono NF' !important; -} - +} \ No newline at end of file diff --git a/nix-system-configs/modules/system/forgejo.nix b/nix-system-configs/modules/system/forgejo.nix index c660db5..b02e2b0 100644 --- a/nix-system-configs/modules/system/forgejo.nix +++ b/nix-system-configs/modules/system/forgejo.nix @@ -84,6 +84,9 @@ in { # Forgejo configuration services.forgejo = { enable = true; + # Explicit custom directory where Forgejo will look for custom templates/assets + # Ensure this matches what systemd.tmpfiles will populate below. + customDir = "/var/lib/forgejo/custom"; database = { createDatabase = false; # Database already created, DO NOT REMOVE THIS OR IT WILL DEFAULT INTO INTERNAL ONE type = "postgres"; @@ -126,6 +129,8 @@ in { systemd.tmpfiles.rules = [ "d '${config.services.forgejo.customDir}/templates' - forgejo forgejo - -" + # create the custom/templates/custom folder so header.tmpl can live under templates/custom + "d '${config.services.forgejo.customDir}/templates/custom' - forgejo forgejo - -" "d '${config.services.forgejo.customDir}/public' - forgejo forgejo - -" "d '${config.services.forgejo.customDir}/public/assets' - forgejo forgejo - -" "d '${config.services.forgejo.customDir}/public/assets/css' - forgejo forgejo - -" @@ -139,6 +144,10 @@ in { "C+ '${config.services.forgejo.customDir}/templates/home.tmpl' - forgejo forgejo - ${ ../styling/forgejo/home.tmpl }" + # copy a small header.tmpl into templates/custom so we can force-include custom CSS into the + "C+ '${config.services.forgejo.customDir}/templates/custom/header.tmpl' - forgejo forgejo - ${ + ../styling/forgejo/header.tmpl + }" ]; # Open ports in the firewall.