2019-05-09 18:28:40 +02:00
|
|
|
{ config, lib, ... }:
|
2019-02-26 13:44:40 +01:00
|
|
|
|
2019-03-20 02:57:59 +01:00
|
|
|
with lib;
|
|
|
|
|
|
|
|
mkIf (elem "gitea" config.machine.services) {
|
2019-10-07 02:48:07 +02:00
|
|
|
services.gitea = let
|
|
|
|
cfg = config.machine;
|
|
|
|
domain = (findFirst (s: s.service == "gitea") cfg cfg.vHosts).domain;
|
|
|
|
in {
|
2019-02-26 13:44:40 +01:00
|
|
|
enable = true;
|
|
|
|
user = "git";
|
|
|
|
cookieSecure = true;
|
2019-10-07 02:48:07 +02:00
|
|
|
domain = domain;
|
|
|
|
rootUrl = "http://${domain}/";
|
2019-02-26 13:44:40 +01:00
|
|
|
database = {
|
|
|
|
type = "mysql";
|
|
|
|
user = "git";
|
|
|
|
name = "gitea";
|
2019-10-07 02:48:07 +02:00
|
|
|
passwordFile = "${cfg.secretPath}/gitea_db";
|
2019-02-26 13:44:40 +01:00
|
|
|
};
|
|
|
|
extraConfig = ''
|
|
|
|
[repository]
|
2019-03-04 10:35:50 +01:00
|
|
|
DISABLE_HTTP_GIT = false
|
2019-02-26 13:44:40 +01:00
|
|
|
USE_COMPAT_SSH_URI = true
|
|
|
|
|
|
|
|
[security]
|
|
|
|
INSTALL_LOCK = true
|
|
|
|
COOKIE_USERNAME = gitea_username
|
|
|
|
COOKIE_REMEMBER_NAME = gitea_userauth
|
|
|
|
|
|
|
|
[service]
|
|
|
|
DISABLE_REGISTRATION = true
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
users.users.git = {
|
2019-07-03 08:38:11 +02:00
|
|
|
description = "Gitea Service";
|
2019-02-26 13:44:40 +01:00
|
|
|
isNormalUser = true;
|
2019-07-03 08:38:11 +02:00
|
|
|
home = config.services.gitea.stateDir;
|
2019-02-26 13:44:40 +01:00
|
|
|
createHome = true;
|
2019-07-03 08:38:11 +02:00
|
|
|
useDefaultShell = true;
|
2019-02-26 13:44:40 +01:00
|
|
|
};
|
|
|
|
}
|