services: add gitea

This commit is contained in:
Bruno BELANYI 2021-01-31 17:46:46 +01:00
parent 5d41f6206d
commit b4b62b5bc6
3 changed files with 46 additions and 0 deletions

View file

@ -69,6 +69,8 @@
# List services that you want to enable: # List services that you want to enable:
my.services = { my.services = {
# Gitea forge
gitea.enable = true;
# Matrix backend and Element chat front-end # Matrix backend and Element chat front-end
matrix.enable = true; matrix.enable = true;
}; };

View file

@ -2,6 +2,7 @@
{ {
imports = [ imports = [
./gitea.nix
./matrix.nix ./matrix.nix
./nginx.nix ./nginx.nix
]; ];

43
services/gitea.nix Normal file
View file

@ -0,0 +1,43 @@
# A low-ressource, full-featured git forge.
{ config, lib, ... }:
let
cfg = config.my.services.gitea;
domain = config.networking.domain;
giteaDomain = "gitea.${config.networking.domain}";
in
{
options.my.services.gitea = {
enable = lib.mkEnableOption "Gitea";
};
config = lib.mkIf cfg.enable {
services.gitea = {
enable = true;
appName = "Ambroisie's Gitea";
domain = "${giteaDomain}";
rootUrl = "https://${giteaDomain}";
useWizard = true;
disableRegistration = true;
lfs.enable = true;
};
# 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
'';
};
# Proxy to Gitea
services.nginx.virtualHosts."${giteaDomain}" = {
forceSSL = true;
useACMEHost = "${domain}";
locations."/".proxyPass = "http://localhost:3000/";
};
};
}