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