services: gitea: clean up configuration
I want the ssh addresses to use 'git' as a user, so the service must be set up with this user as well. I also want the port to be configurable in case I need to change it.
This commit is contained in:
parent
6038d0df60
commit
303da60e0b
|
@ -6,38 +6,60 @@ let
|
|||
giteaDomain = "gitea.${config.networking.domain}";
|
||||
in
|
||||
{
|
||||
options.my.services.gitea = {
|
||||
enable = lib.mkEnableOption "Gitea";
|
||||
options.my.services.gitea = with lib; {
|
||||
enable = mkEnableOption "Gitea";
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 3000;
|
||||
example = 8080;
|
||||
description = "Internal port";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.gitea = {
|
||||
enable = true;
|
||||
appName = "Ambroisie's Gitea";
|
||||
|
||||
appName = "Ambroisie's forge";
|
||||
httpPort = cfg.port;
|
||||
domain = "${giteaDomain}";
|
||||
rootUrl = "https://${giteaDomain}";
|
||||
|
||||
user = "git";
|
||||
lfs.enable = true;
|
||||
|
||||
useWizard = true;
|
||||
disableRegistration = true;
|
||||
lfs.enable = true;
|
||||
|
||||
# only send cookies via HTTPS
|
||||
cookieSecure = true;
|
||||
|
||||
database = {
|
||||
type = "postgres"; # Automatic setup
|
||||
user = "git"; # User needs to be the same as gitea user
|
||||
};
|
||||
};
|
||||
|
||||
# Enable DB
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
authentication = ''
|
||||
local gitea all ident map=gitea-users
|
||||
'';
|
||||
identMap = '' # Map the gitea user to postgresql
|
||||
gitea-users gitea gitea
|
||||
'';
|
||||
users.users.git = {
|
||||
description = "Gitea Service";
|
||||
home = config.services.gitea.stateDir;
|
||||
useDefaultShell = true;
|
||||
group = "git";
|
||||
|
||||
# The service for gitea seems to hardcode the group as
|
||||
# gitea, so, uh, just in case?
|
||||
extraGroups = [ "gitea" ];
|
||||
|
||||
isSystemUser = true;
|
||||
};
|
||||
users.groups.git = { };
|
||||
|
||||
# Proxy to Gitea
|
||||
services.nginx.virtualHosts."${giteaDomain}" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "${domain}";
|
||||
|
||||
locations."/".proxyPass = "http://localhost:3000/";
|
||||
locations."/".proxyPass = "http://localhost:${toString cfg.port}/";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue