gitea email support

This commit is contained in:
Danilo Reyes 2025-09-19 11:15:26 -06:00
parent 3d16556312
commit c234acacec
3 changed files with 40 additions and 25 deletions

View File

@ -1,4 +1,9 @@
{ lib, config, ... }:
{
lib,
config,
pkgs,
...
}:
let
cfg = config.my.servers.gitea;
setup = import ./setup.nix { inherit lib config; };
@ -8,16 +13,16 @@ in
config.services = {
gitea = lib.mkIf cfg.enable {
enable = true;
appName = "Danilo Git";
domain = cfg.host;
rootUrl = cfg.url;
settings = {
session.COOKIE_SECURE = true;
server = {
HTTP_PORT = cfg.port;
START_SSH_SERVER = true;
SSH_PORT = 2222;
SSH_LISTEN_PORT = 2222;
server.HTTP_PORT = cfg.port;
mailer = {
ENABLED = true;
MAILER_TYPE = "sendmail";
FROM = config.my.smtpemail;
SENDMAIL_PATH = "${pkgs.msmtp}/bin/msmtp";
};
};
database = {

View File

@ -40,12 +40,9 @@ in
go-vod.enable = lib.mkEnableOption "enable";
};
config = lib.mkIf (cfg.enable && config.my.servers.postgres.enable) {
sops.secrets = {
smtp-password = { };
nextcloud-adminpass = {
owner = config.users.users.nextcloud.name;
inherit (config.users.users.nextcloud) group;
};
sops.secrets.nextcloud-adminpass = {
owner = config.users.users.nextcloud.name;
inherit (config.users.users.nextcloud) group;
};
nixpkgs.config.permittedInsecurePackages = [
"nodejs-14.21.3"
@ -64,18 +61,6 @@ in
;
};
};
programs.msmtp = {
enable = true;
accounts.default = {
auth = true;
host = "smtp.gmail.com";
port = 587;
tls = true;
from = config.my.smtpemail;
user = config.my.smtpemail;
passwordeval = "cat ${config.sops.secrets.smtp-password.path}";
};
};
services = {
nextcloud = {
enable = true;

View File

@ -0,0 +1,25 @@
{
config,
lib,
...
}:
let
cfg = config.my.servers;
in
{
config = lib.mkIf cfg.nextcloud.enable or cfg.gitea.enable {
sops.secrets.smtp-password = { };
programs.msmtp = {
enable = true;
accounts.default = {
auth = true;
host = "smtp.gmail.com";
port = 587;
tls = true;
from = config.my.smtpemail;
user = config.my.smtpemail;
passwordeval = "cat ${config.sops.secrets.smtp-password.path}";
};
};
};
}