]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/databases/default.nix
Completely remove immae.eu
[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
IB
12
13 config.nixpkgs.overlays = lib.mkIf cfg.enable [ (self: super: {
14 postgresql = self.postgresql_11_custom;
15 }) ];
16
182ae57f 17 config.myServices.databases = lib.mkIf cfg.enable {
4aac110f
IB
18 mariadb = {
19 enable = true;
20 ldapConfig = {
ab8f306d
IB
21 inherit (config.myEnv.ldap) host base;
22 inherit (config.myEnv.databases.mysql.pam) dn filter password;
4aac110f 23 };
9f6a7862 24 replicationLdapConfig = {
ab8f306d
IB
25 inherit (config.myEnv.ldap) host base;
26 inherit (config.myEnv.servers.eldiron.ldap) dn password;
9f6a7862 27 };
ab8f306d 28 credentials.root = config.myEnv.databases.mysql.systemUsers.root;
4aac110f
IB
29 };
30
31 openldap = {
ab8f306d
IB
32 accessFile = "${config.myEnv.privateFiles}/ldap.conf";
33 baseDn = config.myEnv.ldap.base;
34 rootDn = config.myEnv.ldap.root_dn;
35 rootPw = config.myEnv.ldap.root_pw;
4aac110f
IB
36 enable = true;
37 };
38
39 postgresql = {
40 ldapConfig = {
ab8f306d
IB
41 inherit (config.myEnv.ldap) host base;
42 inherit (config.myEnv.databases.postgresql.pam) dn filter password;
4aac110f
IB
43 };
44 replicationLdapConfig = {
ab8f306d
IB
45 inherit (config.myEnv.ldap) host base;
46 inherit (config.myEnv.servers.eldiron.ldap) dn password;
4aac110f
IB
47 };
48 authorizedHosts = {
4aac110f
IB
49 };
50 replicationHosts = {
8183b8bb 51 backup-2 = {
ab8f306d
IB
52 ip4 = [config.myEnv.servers.backup-2.ips.main.ip4];
53 ip6 = config.myEnv.servers.backup-2.ips.main.ip6;
8183b8bb 54 };
4aac110f
IB
55 };
56 enable = true;
57 };
58
182ae57f
IB
59 redis.enable = true;
60 };
61}