Move gitea to forgejo
This commit is contained in:
parent
9c64c4dca9
commit
7f1f963d5e
|
@ -9,11 +9,28 @@ let
|
||||||
|
|
||||||
signingKey = "0x3681E15E5C14A241";
|
signingKey = "0x3681E15E5C14A241";
|
||||||
|
|
||||||
catppuccinThemes = builtins.fetchurl {
|
catppuccinThemes = pkgs.fetchurl {
|
||||||
url = "https://github.com/catppuccin/gitea/releases/download/v0.2.1/catppuccin-gitea.tar.gz";
|
url = "https://github.com/catppuccin/gitea/releases/download/v0.4.1/catppuccin-gitea.tar.gz";
|
||||||
sha256 = "sha256:18l67whffayrgylsf5j6g7sj95anjcjl0cy7fzqn1wrm0gg2xns0";
|
hash = "sha256-/P4fLvswitlfeaKaUykrEKvjbNpw5Q/nzGQ/GZaLyUI=";
|
||||||
};
|
};
|
||||||
themes = strings.concatStringsSep "," [
|
staticDir = pkgs.runCommandLocal "forgejo-static" { } ''
|
||||||
|
mkdir -p $out
|
||||||
|
tmp=$(mktemp -d)
|
||||||
|
cp -r ${config.services.forgejo.package.data}/* $tmp
|
||||||
|
chmod -R +w $tmp
|
||||||
|
|
||||||
|
# Copy icons
|
||||||
|
install -m 0644 ${./gitea/img}/* $tmp/public/assets/img
|
||||||
|
|
||||||
|
# Copy the themes
|
||||||
|
env PATH=${pkgs.gzip}/bin:${pkgs.gnutar}/bin:$PATH \
|
||||||
|
tar -xvf ${catppuccinThemes} -C $tmp/public/assets/css
|
||||||
|
|
||||||
|
cp -r $tmp/* $out
|
||||||
|
'';
|
||||||
|
|
||||||
|
default-themes = "forgejo-auto, forgejo-light, forgejo-dark, gitea-auto, gitea-light, gitea-dark, forgejo-auto-deuteranopia-protanopia, forgejo-light-deuteranopia-protanopia, forgejo-dark-deuteranopia-protanopia, forgejo-auto-tritanopia, forgejo-light-tritanopia, forgejo-dark-tritanopia";
|
||||||
|
themes = strings.concatStringsSep ", " [
|
||||||
"catppuccin-macchiato-green"
|
"catppuccin-macchiato-green"
|
||||||
"catppuccin-mocha-teal"
|
"catppuccin-mocha-teal"
|
||||||
"catppuccin-macchiato-sky"
|
"catppuccin-macchiato-sky"
|
||||||
|
@ -73,6 +90,13 @@ let
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
users.users.${user} = {
|
||||||
|
home = config.services.forgejo.stateDir;
|
||||||
|
useDefaultShell = true;
|
||||||
|
isSystemUser = true;
|
||||||
|
group = user;
|
||||||
|
};
|
||||||
|
users.groups.${user} = { };
|
||||||
sops.secrets."gitea/signing-key".owner = user;
|
sops.secrets."gitea/signing-key".owner = user;
|
||||||
sops.secrets."gitea/mailer-password".owner = user;
|
sops.secrets."gitea/mailer-password".owner = user;
|
||||||
# database
|
# database
|
||||||
|
@ -83,9 +107,9 @@ in
|
||||||
noCloudflare = true;
|
noCloudflare = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.gitea.requires = [ "postgresql.service" ];
|
systemd.services.forgejo.requires = [ "postgresql.service" ];
|
||||||
|
|
||||||
services.gitea = {
|
services.forgejo = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
inherit user;
|
inherit user;
|
||||||
|
@ -98,6 +122,7 @@ in
|
||||||
ROOT_URL = "https://${host}/";
|
ROOT_URL = "https://${host}/";
|
||||||
HTTP_ADDRESS = "127.0.0.1";
|
HTTP_ADDRESS = "127.0.0.1";
|
||||||
HTTP_PORT = port;
|
HTTP_PORT = port;
|
||||||
|
STATIC_ROOT_PATH = staticDir;
|
||||||
};
|
};
|
||||||
repository = {
|
repository = {
|
||||||
DEFAULT_PRIVATE = "private";
|
DEFAULT_PRIVATE = "private";
|
||||||
|
@ -114,7 +139,7 @@ in
|
||||||
SIGNING_NAME = "DTTHGit";
|
SIGNING_NAME = "DTTHGit";
|
||||||
SIGNING_EMAIL = "dtth-gitea@nkagami.me";
|
SIGNING_EMAIL = "dtth-gitea@nkagami.me";
|
||||||
};
|
};
|
||||||
ui.THEMES = "auto,gitea,arc-green," + themes;
|
ui.THEMES = default-themes + "," + themes;
|
||||||
"ui.meta" = {
|
"ui.meta" = {
|
||||||
AUTHOR = "DTTHgit - Gitea instance for GTTH";
|
AUTHOR = "DTTHgit - Gitea instance for GTTH";
|
||||||
DESCRIPTION = "DTTHGit is a custom Gitea instance hosted for DTTH members only.";
|
DESCRIPTION = "DTTHGit is a custom Gitea instance hosted for DTTH members only.";
|
||||||
|
@ -175,7 +200,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
# Set up gpg signing key
|
# Set up gpg signing key
|
||||||
systemd.services.gitea = {
|
systemd.services.forgejo = {
|
||||||
path = with pkgs; [ gnupg ];
|
path = with pkgs; [ gnupg ];
|
||||||
environment.GNUPGHOME = "${config.services.gitea.stateDir}/.gnupg";
|
environment.GNUPGHOME = "${config.services.gitea.stateDir}/.gnupg";
|
||||||
# https://github.com/NixOS/nixpkgs/commit/93c1d370db28ad4573fb9890c90164ba55391ce7
|
# https://github.com/NixOS/nixpkgs/commit/93c1d370db28ad4573fb9890c90164ba55391ce7
|
||||||
|
@ -191,15 +216,6 @@ in
|
||||||
echo "trusted-key ${signingKey}" >> ${config.services.gitea.stateDir}/.gnupg/gpg.conf
|
echo "trusted-key ${signingKey}" >> ${config.services.gitea.stateDir}/.gnupg/gpg.conf
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy icons
|
|
||||||
mkdir -p ${config.services.gitea.stateDir}/custom/public/img
|
|
||||||
install -m 0644 ${./gitea/img}/* ${config.services.gitea.stateDir}/custom/public/img
|
|
||||||
|
|
||||||
# Copy the themes
|
|
||||||
mkdir -p ${config.services.gitea.stateDir}/custom/public/css
|
|
||||||
env PATH=${pkgs.gzip}/bin:${pkgs.gnutar}/bin:$PATH \
|
|
||||||
tar -xvf ${catppuccinThemes} -C ${config.services.gitea.stateDir}/custom/public/css/
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue