services: gitea: factorize gitea user

This commit is contained in:
Antoine Martin 2022-06-14 19:28:06 +02:00
parent 3dc21e88a8
commit 42e681bb81

View file

@ -17,6 +17,8 @@
domain = config.networking.domain;
hostname = config.networking.hostName;
fqdn = "${hostname}.${domain}";
giteaUser = "git";
in {
options.my.services.gitea = let
inherit (lib) types;
@ -33,11 +35,11 @@ in {
config = mkIf cfg.enable {
# use git as user to have `git clone git@git.domain`
users.users.git = {
users.users.${giteaUser} = {
description = "Gitea Service";
home = config.services.gitea.stateDir;
useDefaultShell = true;
group = "git";
group = giteaUser;
# the systemd service for the gitea module seems to hardcode the group as
# gitea, so, uh, just in case?
@ -45,11 +47,11 @@ in {
isSystemUser = true;
};
users.groups.git = {};
users.groups.${giteaUser} = {};
services.gitea = {
enable = true;
user = "git";
user = giteaUser;
domain = "git.${domain}";
appName = "Personal Forge";
rootUrl = "https://git.${domain}/";
@ -80,7 +82,7 @@ in {
database = {
type = "postgres";
# user needs to be the same as gitea user
user = "git";
user = giteaUser;
};
};