From 4c393a7f926175b28a896114eb08c7384475c873 Mon Sep 17 00:00:00 2001 From: Christine Elisabeth Koppel Date: Thu, 12 Feb 2026 23:56:49 +0100 Subject: [PATCH] I fucking hate NixOS wiki sometimes. --- nix-system-configs/modules/system/forgejo.nix | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/nix-system-configs/modules/system/forgejo.nix b/nix-system-configs/modules/system/forgejo.nix index 1b523a4..a8a8b3c 100644 --- a/nix-system-configs/modules/system/forgejo.nix +++ b/nix-system-configs/modules/system/forgejo.nix @@ -152,6 +152,27 @@ in { }" ]; + # Fallback: one-shot systemd service to copy custom assets on activation (works even if tmpfiles isn't applied or for live testing) + systemd.services."forgejo-custom-files" = { + description = "Install Forgejo custom templates and assets into customDir"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "oneshot"; + # Use bash -c to run a compact copy/install script that ensures dirs exist and files are owned by forgejo + ExecStart = ''${pkgs.bash}/bin/bash -c "set -eu; \ + install -d -m0755 -o forgejo -g forgejo ${config.services.forgejo.customDir}/public/assets/fonts; \ + install -d -m0755 -o forgejo -g forgejo ${config.services.forgejo.customDir}/public/assets/css; \ + install -d -m0755 -o forgejo -g forgejo ${config.services.forgejo.customDir}/templates/custom; \ + cp -a ${mapleFonts}/fonts/MapleMonoNerd.ttf ${config.services.forgejo.customDir}/public/assets/fonts/MapleMonoNerd.ttf; \ + cp -a ${toString ../styling/forgejo/header.tmpl} ${config.services.forgejo.customDir}/templates/custom/header.tmpl; \ + cp -a ${toString ../styling/forgejo/home.tmpl} ${config.services.forgejo.customDir}/templates/home.tmpl; \ + cp -a ${toString ../styling/forgejo/theme-custom.css} ${config.services.forgejo.customDir}/public/assets/css/theme-custom.css; \ + chown -R forgejo:forgejo ${config.services.forgejo.customDir}"''; + }; + wantedBy = [ "multi-user.target" ]; + }; + # Open ports in the firewall. networking.firewall.allowedTCPPorts = [3000];