mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-12-07 13:32:15 -06:00
feat: added syncthing
This commit is contained in:
parent
5da8744578
commit
5a5f7ed62d
4 changed files with 34 additions and 31 deletions
|
|
@ -21,6 +21,7 @@ in
|
||||||
};
|
};
|
||||||
paths = {
|
paths = {
|
||||||
path0 = "${varLib}/${name}";
|
path0 = "${varLib}/${name}";
|
||||||
|
path1 = "${varLib}/${name}/backups";
|
||||||
};
|
};
|
||||||
domains = {
|
domains = {
|
||||||
url0 = domain;
|
url0 = domain;
|
||||||
|
|
|
||||||
|
|
@ -6,16 +6,17 @@
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (flake.config.machines.devices) ceres;
|
inherit (flake.config.machines.devices) ceres;
|
||||||
inherit (flake.config.services.instances)
|
inherit (flake.config.services)
|
||||||
smtp
|
instances
|
||||||
forgejo
|
|
||||||
syncthing
|
|
||||||
web
|
|
||||||
;
|
;
|
||||||
service = forgejo;
|
service = instances.forgejo;
|
||||||
localhost = web.localhost.address0;
|
localhost = instances.web.localhost.address0;
|
||||||
host = service.domains.url0;
|
host = service.domains.url0;
|
||||||
backupPath = "${syncthing.paths.path0}/postgres-backups/${service.name}";
|
|
||||||
|
caddy = instances.caddy;
|
||||||
|
postgres = instances.postgresql;
|
||||||
|
syncthing = instances.syncthing;
|
||||||
|
backupPath = "${instances.syncthing.paths.path1}/${service.name}";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
services = {
|
services = {
|
||||||
|
|
@ -51,11 +52,11 @@ in
|
||||||
};
|
};
|
||||||
mailer = {
|
mailer = {
|
||||||
ENABLED = true;
|
ENABLED = true;
|
||||||
SMTP_ADDR = smtp.hostname;
|
SMTP_ADDR = instances.smtp.hostname;
|
||||||
FROM = service.email.address0;
|
FROM = service.email.address0;
|
||||||
USER = service.email.address0;
|
USER = service.email.address0;
|
||||||
PROTOCOL = "smtp+starttls";
|
PROTOCOL = "smtp+starttls";
|
||||||
SMTP_PORT = smtp.ports.port0;
|
SMTP_PORT = instances.smtp.ports.port0;
|
||||||
SEND_AS_PLAIN_TEXT = true;
|
SEND_AS_PLAIN_TEXT = true;
|
||||||
USE_CLIENT_CERT = false;
|
USE_CLIENT_CERT = false;
|
||||||
};
|
};
|
||||||
|
|
@ -117,13 +118,12 @@ in
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"Z ${service.paths.path0} 755 ${service.name} ${service.name} -"
|
"Z ${service.paths.path0} 755 ${service.name} ${service.name} -"
|
||||||
"Z ${service.sops.path0} 755 ${service.name} ${service.name} -"
|
"Z ${service.sops.path0} 755 ${service.name} ${service.name} -"
|
||||||
"d ${backupPath} 0750 ${service.name} ${syncthing.name} -"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
users.users.${service.name}.extraGroups = [
|
users.users.${service.name}.extraGroups = [
|
||||||
"caddy"
|
caddy.name
|
||||||
"postgres"
|
postgres.name
|
||||||
"syncthing"
|
syncthing.name
|
||||||
];
|
];
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ let
|
||||||
;
|
;
|
||||||
|
|
||||||
service = instances.postgresql;
|
service = instances.postgresql;
|
||||||
backupPath = "${instances.syncthing.paths.path0}/postgres-backups";
|
backupPath = "${instances.syncthing.paths.path1}/${service.name}";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
services = {
|
services = {
|
||||||
|
|
@ -25,13 +25,6 @@ in
|
||||||
};
|
};
|
||||||
postgresql = {
|
postgresql = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# ensureDatabases = [ firefly-iii.name ];
|
|
||||||
# ensureUsers = [
|
|
||||||
# {
|
|
||||||
# name = firefly-iii.name;
|
|
||||||
# ensureDBOwnership = true;
|
|
||||||
# }
|
|
||||||
# ];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
networking = {
|
networking = {
|
||||||
|
|
@ -53,14 +46,11 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
|
||||||
"d ${backupPath} 0750 ${service.name} ${instances.syncthing.name} -"
|
|
||||||
];
|
|
||||||
|
|
||||||
users.users.${service.name}.extraGroups = [
|
users.users.${service.name}.extraGroups = [
|
||||||
instances.nextcloud.name
|
instances.nextcloud.name
|
||||||
instances.mastodon.name
|
instances.mastodon.name
|
||||||
instances.forgejo.name
|
instances.forgejo.name
|
||||||
|
instances.syncthing.name
|
||||||
];
|
];
|
||||||
|
|
||||||
system.activationScripts.postgresCommands = ''
|
system.activationScripts.postgresCommands = ''
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,15 @@ let
|
||||||
mars
|
mars
|
||||||
ceres
|
ceres
|
||||||
;
|
;
|
||||||
inherit (flake.config.services.instances)
|
inherit (flake.config.services)
|
||||||
syncthing
|
instances
|
||||||
web
|
|
||||||
;
|
;
|
||||||
hostname = config.networking.hostName;
|
hostname = config.networking.hostName;
|
||||||
localhost = web.localhost.address1;
|
localhost = instances.web.localhost.address1;
|
||||||
service = syncthing;
|
service = instances.syncthing;
|
||||||
|
postgres = instances.postgresql;
|
||||||
|
forgejo = instances.forgejo;
|
||||||
|
backupPath = "${service.paths.path1}";
|
||||||
|
|
||||||
syncDevices = {
|
syncDevices = {
|
||||||
synologySync = {
|
synologySync = {
|
||||||
|
|
@ -59,6 +61,16 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
# Main syncthing directory
|
||||||
|
"d ${service.paths.path0} 0755 ${service.name} ${service.name} -"
|
||||||
|
|
||||||
|
# Backup directories
|
||||||
|
"d ${backupPath} 0755 ${service.name} ${service.name} -"
|
||||||
|
"d ${backupPath}/${postgres.name} 0755 ${postgres.name} ${service.name} -"
|
||||||
|
"d ${backupPath}/${forgejo.name} 0750 ${forgejo.name} ${service.name} -"
|
||||||
|
];
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
firewall = {
|
firewall = {
|
||||||
allowedTCPPorts = [
|
allowedTCPPorts = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue