]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/databases/default.nix
Add specification for the private config file as a module.
[perso/Immae/Config/Nix.git] / modules / private / databases / default.nix
1 { lib, config, nodes, ... }:
2 let
3 cfg = config.myServices.databases;
4 in
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 };
12
13 config.nixpkgs.overlays = lib.mkIf cfg.enable [ (self: super: {
14 postgresql = self.postgresql_11_custom;
15 }) ];
16
17 config.myServices.databases = lib.mkIf cfg.enable {
18 mariadb = {
19 enable = true;
20 ldapConfig = {
21 inherit (config.myEnv.ldap) host base;
22 inherit (config.myEnv.databases.mysql.pam) dn filter password;
23 };
24 replicationLdapConfig = {
25 inherit (config.myEnv.ldap) host base;
26 inherit (config.myEnv.servers.eldiron.ldap) dn password;
27 };
28 credentials.root = config.myEnv.databases.mysql.systemUsers.root;
29 };
30
31 openldap = {
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;
36 enable = true;
37 };
38
39 postgresql = {
40 ldapConfig = {
41 inherit (config.myEnv.ldap) host base;
42 inherit (config.myEnv.databases.postgresql.pam) dn filter password;
43 };
44 replicationLdapConfig = {
45 inherit (config.myEnv.ldap) host base;
46 inherit (config.myEnv.servers.eldiron.ldap) dn password;
47 };
48 authorizedHosts = {
49 immaeEu = [{
50 ip4 = [
51 config.myEnv.servers.immaeEu.ips.main.ip4
52 config.myEnv.servers.immaeEu.ips.alt.ip4
53 ];
54 }];
55 };
56 replicationHosts = {
57 backup-1 = {
58 ip4 = [config.myEnv.servers.backup-1.ips.main.ip4];
59 ip6 = config.myEnv.servers.backup-1.ips.main.ip6;
60 };
61 backup-2 = {
62 ip4 = [config.myEnv.servers.backup-2.ips.main.ip4];
63 ip6 = config.myEnv.servers.backup-2.ips.main.ip6;
64 };
65 };
66 enable = true;
67 };
68
69 redis.enable = true;
70 };
71 }