diff --git a/assets/branding/logo-head.svg b/assets/branding/logo-head.svg
new file mode 100644
index 0000000..2617489
--- /dev/null
+++ b/assets/branding/logo-head.svg
@@ -0,0 +1,112 @@
+
+
+
+
diff --git a/assets/branding/logo.svg b/assets/branding/logo.svg
new file mode 100644
index 0000000..3ff139f
--- /dev/null
+++ b/assets/branding/logo.svg
@@ -0,0 +1,109 @@
+
+
+
+
diff --git a/assets/gitea/templates/home.tmpl b/assets/gitea/templates/home.tmpl
new file mode 100644
index 0000000..deca94e
--- /dev/null
+++ b/assets/gitea/templates/home.tmpl
@@ -0,0 +1,12 @@
+{{template "base/head" .}}
+
+

+
+
+
+
+
+{{template "base/footer" .}}
diff --git a/assets/gitea/theme.css b/assets/gitea/theme.css
new file mode 100644
index 0000000..7d8ba5c
--- /dev/null
+++ b/assets/gitea/theme.css
@@ -0,0 +1,18 @@
+@import "/assets/css/theme-gitea-dark.css";
+
+:root {
+ --is-dark-theme: true;
+
+ --accent-color: 221, 85, 85; /* #d55 */
+ --gitea-color-primary-dark-4: 221, 85, 85;
+ --accent-color-secondary: 96, 72, 10;
+ --accent-color-hover: 170, 68, 68;
+ --color-primary: rgb(var(--accent-color));
+ --color-secondary: rgb(var(--accent-color-secondary));
+ --button-color: rgb(var(--accent-color));
+ --button-color-hover: rgb(var(--accent-color-hover));
+}
+
+.navbar-left > #navbar-logo.item, .navbar-right > #navbar-logo.item, .navbar-mobile-right > #navbar-logo.item {
+ padding: 3px;
+}
diff --git a/nixos/modules/gitea.nix b/nixos/modules/gitea.nix
index 92e1ef3..686831f 100644
--- a/nixos/modules/gitea.nix
+++ b/nixos/modules/gitea.nix
@@ -1,8 +1,60 @@
-{ config, ... }:
+{ config, pkgs, ... }:
let
inherit (config.networking) fqdn;
acmeEnabled = config.acme.enable;
+
+ themeName = "tuxcord";
+ giteaPublic = pkgs.linkFarm "gitea-public" [
+ {
+ name = "assets/css/theme-${themeName}.css";
+ path = ../../assets/gitea/theme.css;
+ }
+ {
+ name = "assets/img";
+ path = makeGiteaImages {
+ big = ../../assets/branding/logo.svg;
+ small = ../../assets/branding/logo-head.svg;
+ rasterWidth = 1024;
+ };
+ }
+ {
+ name = "assets/images/full-logo.svg";
+ path = ../../assets/branding/logo.svg;
+ }
+ ];
+ giteaTemplates = ../../assets/gitea/templates;
+
+ makeGiteaImages =
+ {
+ big,
+ small,
+ rasterWidth,
+ }:
+ pkgs.stdenv.mkDerivation rec {
+ name = "gitea-images";
+
+ srcs = [
+ big
+ small
+ ];
+ unpackPhase = "true";
+
+ buildInputs = with pkgs; [
+ inkscape
+ ];
+
+ # https://docs.gitea.com/administration/customizing-gitea#changing-the-logo
+ buildPhase = ''
+ mkdir -p $out
+
+ cp "${big}" $out/logo.svg
+ inkscape -w ${toString rasterWidth} ${big} -o $out/logo.png
+
+ cp "${small}" $out/favicon.svg
+ inkscape -w ${toString rasterWidth} ${small} -o $out/favicon.png
+ '';
+ };
in
{
services.gitea = {
@@ -31,10 +83,35 @@ in
DEFAULT_BRANCH = "main";
};
- # ui.DEFAULT_THEME = "...";
+ ui = {
+ DEFAULT_THEME = themeName;
+ };
# TODO: once we have email setup this would be nice
mailer.ENABLED = true;
};
};
+
+ systemd.services.gitea-branding = {
+ enable = true;
+
+ wantedBy = [ "gitea.service" ];
+ before = [ "gitea.service" ];
+
+ serviceConfig = {
+ Type = "oneshot";
+ ExecStart = pkgs.writeShellScript "gitea-branding.oneshot" ''
+ ${pkgs.rsync}/bin/rsync -rl --chown gitea:gitea --delete ${giteaPublic}/ ${config.services.gitea.customDir}/public
+ ${pkgs.rsync}/bin/rsync -rl --chown gitea:gitea --delete ${giteaTemplates}/ ${config.services.gitea.customDir}/templates
+ '';
+ };
+ };
+
+ environment.persistence."/persist".directories = [
+ {
+ directory = config.services.gitea.stateDir;
+ group = "gitea";
+ user = "gitea";
+ }
+ ];
}