diff --git a/nix/modules/hive-forge.nix b/nix/modules/hive-forge.nix index 050a505..9187c28 100644 --- a/nix/modules/hive-forge.nix +++ b/nix/modules/hive-forge.nix @@ -108,6 +108,19 @@ in privateNetwork = false; config = { pkgs, ... }: + let + # Build a custom static-root that is the standard forgejo data + # output with our theme CSS added. Using STATIC_ROOT_PATH instead + # of tmpfiles / bind-mounts means the theme is always present in + # the nix store — no separate hive-forge container rebuild needed, + # and no persistent-state directory involved. + staticRootWithTheme = pkgs.runCommand "forgejo-static-with-theme" { } '' + cp -r ${cfg.package.data}/. $out/ + mkdir -p $out/public/assets/css + cp ${../forge-theme/theme-catppuccin-vibec0re.css} \ + $out/public/assets/css/theme-catppuccin-vibec0re.css + ''; + in { system.stateVersion = "25.11"; services.forgejo = { @@ -125,6 +138,9 @@ in SSH_LISTEN_PORT = cfg.sshPort; BUILTIN_SSH_SERVER_USER = "git"; DISABLE_SSH = false; + # Point forgejo at our extended static root that includes + # the custom theme CSS baked straight into the nix store. + STATIC_ROOT_PATH = staticRootWithTheme; }; # Registration off — operator seeds agent users via # `nixos-container run hive-forge -- forgejo admin @@ -146,10 +162,6 @@ in migrations.ALLOW_LOCALNETWORKS = true; log.LEVEL = "Warn"; ui = { - # Catppuccin Mocha theme shipped as a nix-managed CSS file. - # The tmpfiles rule below symlinks the file into the custom - # dir before forgejo starts, so a container rebuild always - # picks up CSS changes without touching persistent state. DEFAULT_THEME = "catppuccin-vibec0re"; THEMES = "catppuccin-vibec0re,forgejo-auto,forgejo-light,forgejo-dark,gitea-auto,gitea-light,gitea-dark"; }; @@ -167,13 +179,6 @@ in }; }; environment.systemPackages = [ pkgs.forgejo ]; - # Deploy the Catppuccin Mocha theme CSS into forgejo's custom - # public assets directory. Using a symlink (L+) so container - # rebuilds automatically reflect CSS edits without extra copies. - systemd.tmpfiles.rules = [ - "d /var/lib/forgejo/custom/public/assets/css 0755 forgejo forgejo -" - "C+ /var/lib/forgejo/custom/public/assets/css/theme-catppuccin-vibec0re.css 0644 forgejo forgejo - ${../forge-theme/theme-catppuccin-vibec0re.css}" - ]; }; };