diff --git a/nix-system-configs/modules/styling/forgejo/home.tmpl b/nix-system-configs/modules/styling/forgejo/home.tmpl
new file mode 100644
index 0000000..0a4b2fc
--- /dev/null
+++ b/nix-system-configs/modules/styling/forgejo/home.tmpl
@@ -0,0 +1,13 @@
+[[:Template:Template "base/head" .]]
+
+[[:Template:Template "base/footer" .]]
\ No newline at end of file
diff --git a/nix-system-configs/modules/styling/forgejo/theme-custom.css b/nix-system-configs/modules/styling/forgejo/theme-custom.css
new file mode 100644
index 0000000..4ad9f83
--- /dev/null
+++ b/nix-system-configs/modules/styling/forgejo/theme-custom.css
@@ -0,0 +1,18 @@
+@font-face {
+ font-family: 'Maple Mono NF';
+ src: url('/assets/fonts/MapleMonoNerd.ttf') format('truetype');
+ font-weight: normal;
+ font-style: normal;
+ 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', var(--fonts-monospace);
+ /* if you want the UI proportional font to also use Maple, set --fonts-override */
+ /* --fonts-override: 'Maple Mono NF', var(--fonts-override); */
+}
+
diff --git a/nix-system-configs/modules/system/forgejo.nix b/nix-system-configs/modules/system/forgejo.nix
index 4da5e8b..c660db5 100644
--- a/nix-system-configs/modules/system/forgejo.nix
+++ b/nix-system-configs/modules/system/forgejo.nix
@@ -8,6 +8,23 @@
cfg = config.services.forgejo;
srv = cfg.settings.server;
choose = paths: builtins.head (builtins.filter (p: builtins.pathExists p) paths);
+ mapleZip = pkgs.fetchurl {
+ url = "https://github.com/subframe7536/maple-font/releases/download/v7.9/MapleMonoNormal-NF-unhinted.zip";
+ sha256 = "1j8bh8fzrnrj4348xj8l1jpbchbblhi2a7gryarf2mi88xr1yc3f";
+ };
+
+ # Add a runCommand that unpacks the downloaded zip and exposes a stable ttf path
+ mapleFonts = pkgs.runCommand "maple-fonts" {buildInputs = [pkgs.unzip];} ''
+ mkdir -p $out/tmp
+ unzip -q ${mapleZip} -d $out/tmp
+ f="$(find $out/tmp -type f -name '*.ttf' | head -n1)"
+ if [ -z "$f" ]; then
+ echo "no ttf found" >&2
+ exit 1
+ fi
+ mkdir -p $out/fonts
+ cp "$f" $out/fonts/MapleMonoNerd.ttf
+ '';
in {
options.local = {
hostname = lib.mkOption {
@@ -100,8 +117,30 @@ in {
# ENABLED = false;
# };
};
+
+ settings.ui = {
+ DEFAULT_THEME = "custom";
+ THEMES = "forgejo-auto,forgejo-light,forgejo-dark,custom";
+ };
};
+ systemd.tmpfiles.rules = [
+ "d '${config.services.forgejo.customDir}/templates' - 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 - -"
+ # ensure fonts directory exists
+ "d '${config.services.forgejo.customDir}/public/assets/fonts' - forgejo forgejo - -"
+ # install the TTF from the Nix store into the Forgejo customDir
+ "C+ '${config.services.forgejo.customDir}/public/assets/fonts/MapleMonoNerd.ttf' - forgejo forgejo - ${mapleFonts}/fonts/MapleMonoNerd.ttf"
+ "C+ '${config.services.forgejo.customDir}/public/assets/css/theme-custom.css' - forgejo forgejo - ${
+ ../styling/forgejo/theme-custom.css
+ }"
+ "C+ '${config.services.forgejo.customDir}/templates/home.tmpl' - forgejo forgejo - ${
+ ../styling/forgejo/home.tmpl
+ }"
+ ];
+
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [3000];