2022-10-06 21:27:20 +02:00
|
|
|
{ config, pkgs, unstable-pkgs, lib, secrets, ... }:
|
2022-03-07 16:01:52 +01:00
|
|
|
{
|
|
|
|
security.pam.services."gitea".unixAuth = true;
|
|
|
|
|
|
|
|
users.users.git = {
|
|
|
|
description = "Gitea service";
|
|
|
|
home = config.services.gitea.stateDir;
|
|
|
|
useDefaultShell = true;
|
2022-06-21 01:52:34 +02:00
|
|
|
|
2022-03-07 16:01:52 +01:00
|
|
|
group = "gitea";
|
|
|
|
isSystemUser = true;
|
|
|
|
uid = config.ids.uids.git;
|
2022-11-03 23:16:18 +01:00
|
|
|
packages = with unstable-pkgs; [ gitea ];
|
2022-03-07 16:01:52 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
services.gitea = {
|
|
|
|
enable = true;
|
|
|
|
user = "git";
|
|
|
|
cookieSecure = true;
|
|
|
|
rootUrl = "https://git.nani.wtf/";
|
|
|
|
domain = "git.nani.wtf";
|
|
|
|
httpPort = secrets.ports.gitea;
|
|
|
|
disableRegistration = true;
|
|
|
|
|
2022-10-06 21:27:20 +02:00
|
|
|
package = unstable-pkgs.gitea;
|
|
|
|
|
2022-06-21 01:52:34 +02:00
|
|
|
dump = {
|
|
|
|
enable = true;
|
|
|
|
interval = "hourly";
|
|
|
|
};
|
|
|
|
|
2022-03-07 16:01:52 +01:00
|
|
|
database = {
|
2022-11-03 23:16:18 +01:00
|
|
|
type = "postgres";
|
|
|
|
user = "gitea";
|
|
|
|
passwordFile = secrets.keys.postgres.gitea;
|
|
|
|
createDatabase = false;
|
2022-03-07 16:01:52 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
settings = {
|
|
|
|
server = {
|
|
|
|
BUILTIN_SSH_SERVER_USER="git";
|
2022-10-06 21:27:20 +02:00
|
|
|
LANDING_PAGE = "/explore/repos";
|
2022-03-07 16:01:52 +01:00
|
|
|
};
|
|
|
|
|
2022-03-22 16:44:11 +01:00
|
|
|
ui = {
|
2022-10-06 21:27:20 +02:00
|
|
|
DEFAULT_THEME = "monokai";
|
2022-03-22 16:44:11 +01:00
|
|
|
THEMES = lib.strings.concatStringsSep "," [
|
|
|
|
"gitea"
|
|
|
|
"arc-green"
|
2022-10-06 21:27:20 +02:00
|
|
|
|
|
|
|
# Custom
|
|
|
|
"monokai"
|
2022-03-22 16:44:11 +01:00
|
|
|
];
|
|
|
|
};
|
2022-10-14 00:02:19 +02:00
|
|
|
|
|
|
|
"ui.svg".RENDER = true;
|
|
|
|
|
2022-03-07 16:01:52 +01:00
|
|
|
indexer.REPO_INDEXER_ENABLED = true;
|
|
|
|
mailer = {
|
|
|
|
ENABLED = true;
|
|
|
|
FROM = "gitea@nani.wtf";
|
|
|
|
};
|
|
|
|
|
2022-10-14 00:02:19 +02:00
|
|
|
# Looking forward to the day I can uncomment this line
|
|
|
|
# federation.ENABLED = true;
|
|
|
|
packages.ENABLED = false;
|
|
|
|
|
2022-03-22 16:44:11 +01:00
|
|
|
# TODO: fix
|
|
|
|
|
2022-03-07 16:01:52 +01:00
|
|
|
# markup = let
|
|
|
|
# docutils = pkgs.python37.withPackages (ps: with ps; [
|
|
|
|
# docutils # Provides rendering of ReStructured Text files
|
|
|
|
# pygments # Provides syntax highlighting
|
|
|
|
# ]);
|
|
|
|
# in {
|
|
|
|
# restructuredtext = {
|
|
|
|
# ENABLED = true;
|
|
|
|
# FILE_EXTENSIONS = ".rst";
|
|
|
|
# RENDER_COMMAND = "${docutils}/bin/rst2html.py";
|
|
|
|
# IS_INPUT_FILE = false;
|
|
|
|
# };
|
|
|
|
# asciidoc = {
|
|
|
|
# ENABLED = true;
|
|
|
|
# FILE_EXTENSIONS = ".adoc,.asciidoc";
|
|
|
|
# RENDER_COMMAND = "${pkgs.asciidoctor}/bin/asciidoctor -e -a leveloffset=-1 --out-file=- -";
|
|
|
|
# IS_INPUT_FILE = false;
|
|
|
|
# };
|
|
|
|
# };
|
|
|
|
};
|
|
|
|
};
|
2022-10-06 21:27:20 +02:00
|
|
|
|
2022-11-03 23:16:18 +01:00
|
|
|
# TODO: remove when updating to nixpkgs 22.11
|
|
|
|
systemd.services.gitea.serviceConfig.SystemCallFilter =
|
|
|
|
lib.mkForce "~@clock @cpu-emulation @debug @keyring @memlock @module @mount @obsolete @raw-io @reboot @setuid @swap";
|
|
|
|
|
2022-10-06 21:27:20 +02:00
|
|
|
system.activationScripts.linkGiteaThemes.text = let
|
|
|
|
themes = pkgs.stdenv.mkDerivation {
|
|
|
|
pname = "gitea-themes";
|
|
|
|
version = "1.0.0";
|
|
|
|
src = ./themes;
|
|
|
|
|
|
|
|
buildInputs = with pkgs; [ lessc ];
|
|
|
|
buildPhase = ''
|
|
|
|
mkdir out
|
|
|
|
for f in $(find -name 'theme-*.less')
|
|
|
|
do
|
|
|
|
lessc $f out/''${f%.less}.css
|
|
|
|
done;
|
|
|
|
'';
|
|
|
|
installPhase = "mv out $out";
|
|
|
|
};
|
|
|
|
cssParentPath = "${config.services.gitea.stateDir}/custom/public";
|
|
|
|
cssPath = "${cssParentPath}/css";
|
|
|
|
in ''
|
|
|
|
if [[ ! -e "${cssPath}" ]]; then
|
|
|
|
printf "creating symlink at %s...\n" "${cssPath}"
|
|
|
|
mkdir -p "${cssParentPath}"
|
|
|
|
ln -s "${themes}" "${cssPath}"
|
|
|
|
elif [ -L "${cssPath}" ]; then
|
|
|
|
printf "replacing symlink at %s...\n" "${cssPath}"
|
|
|
|
rm ${cssPath}
|
|
|
|
ln -s "${themes}" "${cssPath}"
|
|
|
|
else
|
|
|
|
printf "ERROR: %s already exists and it is not a symlink\n" "${cssPath}"
|
|
|
|
_localstatus=1;
|
|
|
|
fi
|
|
|
|
'';
|
2022-03-07 16:01:52 +01:00
|
|
|
}
|