Forgejo: Difference between revisions
Add infobox for forgejo |
Add a section on theming Forgejo |
||
| Line 138: | Line 138: | ||
Naturally, instead of sops, you may use any file or secret manager, as explained above. | Naturally, instead of sops, you may use any file or secret manager, as explained above. | ||
== Adding a custom theme to Forgejo == | |||
Its possible to [https://forgejo.org/docs/latest/contributor/customization/ customize the CSS styles and HTML templates of Forgejo] declaratively using Nix. In this simple example i will show you how to: Create a basic theme, set it as the default theme and modify the home template. | |||
{{File|3={ config, pkgs, lib, ... }: { | |||
... | |||
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 - -" | |||
"C+ '${config.services.forgejo.customDir}/public/assets/css/theme-custom.css' - forgejo forgejo - ${ | |||
./theme-custom.css | |||
}" | |||
"C+ '${config.services.forgejo.customDir}/templates/home.tmpl' - forgejo forgejo - ${ | |||
./home.tmpl | |||
}" | |||
]; | |||
forgejo.settings.ui = { | |||
DEFAULT_THEME = "custom"; | |||
THEMES = "forgejo-auto,forgejo-light,forgejo-dark,custom"; | |||
}; | |||
... | |||
}|name=/etc/nixos/forgejo/default.nix|lang=nix}}{{File|3=@import url('https://fonts.googleapis.com/css2?family=Space+Mono&display=swap'); | |||
@import "./theme-forgejo-auto.css"; | |||
:root { | |||
--fonts-override: "Space Mono"; | |||
}|name=/etc/nixos/forgejo/theme-custom.css|lang=css}}{{File|3={{template "base/head" .}} | |||
<div role="main" aria-label="{{if .IsSigned}}{{ctx.Locale.Tr "dashboard"}}{{else}}{{ctx.Locale.Tr "home"}}{{end}}" class="page-content home"> | |||
<div class="tw-mb-8 tw-px-8"> | |||
<div class="center"> | |||
<div class="hero"> | |||
<h1 class="ui icon header title"> | |||
Forgejo hosted on NixOS! | |||
</h1> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
{{template "base/footer" .}}|name=/etc/nixos/forgejo/home.tmpl|lang=gotmpl}} | |||
[[Category:Web Applications]] | [[Category:Web Applications]] | ||
[[Category:Server]] | [[Category:Server]] | ||
[[Category:NixOS Manual]] | [[Category:NixOS Manual]] | ||