nixos/services/gitea.nix

55 lines
1.2 KiB
Nix
Raw Normal View History

{ config, lib, ... }:
2019-02-26 13:44:40 +01:00
with lib;
mkIf (elem "gitea" config.machine.services) {
services = {
gitea = let
cfg = config.machine;
domain = (findFirst (s: s.service == "gitea") cfg cfg.vHosts).domain;
in {
enable = true;
2019-02-26 13:44:40 +01:00
user = "git";
database = {
type = "mysql";
user = "git";
name = "gitea";
passwordFile = config.sops.secrets."services/gitea/dbPass".path;
};
2020-11-23 23:07:42 +01:00
settings = {
repository = {
DISABLE_HTTP_GIT = false;
USE_COMPAT_SSH_URI = true;
};
2020-11-23 23:07:42 +01:00
security = {
INSTALL_LOCK = true;
COOKIE_USERNAME = "gitea_username";
COOKIE_REMEMBER_NAME = "gitea_userauth";
};
2019-02-26 13:44:40 +01:00
server = {
DOMAIN = domain;
ROOT_URL = "https://${domain}/";
};
2020-11-23 23:07:42 +01:00
service = {
DISABLE_REGISTRATION = (lib.mkForce true);
};
session = {
cookieSecure = true;
};
2020-11-23 23:07:42 +01:00
};
};
2019-02-26 13:44:40 +01:00
};
sops.secrets."services/gitea/dbPass" = {};
2019-02-26 13:44:40 +01:00
users.users.git = {
description = "Gitea Service";
2019-02-26 13:44:40 +01:00
isNormalUser = true;
home = config.services.gitea.stateDir;
2019-02-26 13:44:40 +01:00
createHome = true;
useDefaultShell = true;
2019-02-26 13:44:40 +01:00
};
}