]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - systems/eldiron/databases/default.nix
Migrate to borg backup
[perso/Immae/Config/Nix.git] / systems / eldiron / databases / default.nix
CommitLineData
1a64deeb 1{ lib, config, secrets, ... }:
182ae57f
IB
2let
3 cfg = config.myServices.databases;
4in
5{
6 options.myServices = {
7 databases.enable = lib.mkEnableOption "my databases service";
182ae57f 8 };
4aac110f 9
1a64deeb 10 config.myServices.dns.zones."immae.eu".subdomains.db-1 = lib.mkIf cfg.enable (with config.myServices.dns.helpers; ips servers.eldiron.ips.main);
182ae57f 11 config.myServices.databases = lib.mkIf cfg.enable {
1a64deeb 12
4aac110f
IB
13 mariadb = {
14 enable = true;
15 ldapConfig = {
ab8f306d
IB
16 inherit (config.myEnv.ldap) host base;
17 inherit (config.myEnv.databases.mysql.pam) dn filter password;
4aac110f 18 };
9f6a7862 19 replicationLdapConfig = {
ab8f306d
IB
20 inherit (config.myEnv.ldap) host base;
21 inherit (config.myEnv.servers.eldiron.ldap) dn password;
9f6a7862 22 };
ab8f306d 23 credentials.root = config.myEnv.databases.mysql.systemUsers.root;
4aac110f
IB
24 };
25
26 openldap = {
1a64deeb 27 accessFile = secrets.ldap-conf;
ab8f306d
IB
28 baseDn = config.myEnv.ldap.base;
29 rootDn = config.myEnv.ldap.root_dn;
30 rootPw = config.myEnv.ldap.root_pw;
4aac110f
IB
31 enable = true;
32 };
33
34 postgresql = {
35 ldapConfig = {
ab8f306d
IB
36 inherit (config.myEnv.ldap) host base;
37 inherit (config.myEnv.databases.postgresql.pam) dn filter password;
4aac110f
IB
38 };
39 replicationLdapConfig = {
ab8f306d
IB
40 inherit (config.myEnv.ldap) host base;
41 inherit (config.myEnv.servers.eldiron.ldap) dn password;
4aac110f
IB
42 };
43 authorizedHosts = {
4aac110f
IB
44 };
45 replicationHosts = {
8183b8bb 46 backup-2 = {
1a64deeb 47 ip4 = config.myEnv.servers.backup-2.ips.main.ip4;
ab8f306d 48 ip6 = config.myEnv.servers.backup-2.ips.main.ip6;
8183b8bb 49 };
4aac110f
IB
50 };
51 enable = true;
52 };
53
182ae57f
IB
54 redis.enable = true;
55 };
56}