X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FConfig%2FNix.git;a=blobdiff_plain;f=modules%2Fprivate%2Fdatabases%2Fmariadb_replication.nix;h=68e6f7fdd809590e503d35d7e4793539b9d695a2;hp=e857c416d1d6ba638b7dd3148246eb6958ef2183;hb=4c4652aabf2cb3ac8b40f2856eca07a1df9c27e0;hpb=da30ae4ffdd153a1eb32fb86f9ca9a65aa19e4e2 diff --git a/modules/private/databases/mariadb_replication.nix b/modules/private/databases/mariadb_replication.nix index e857c41..68e6f7f 100644 --- a/modules/private/databases/mariadb_replication.nix +++ b/modules/private/databases/mariadb_replication.nix @@ -81,9 +81,8 @@ in }; users.groups.mysql.gid = config.ids.gids.mysql; - secrets.keys = lib.flatten (lib.mapAttrsToList (name: hcfg: [ - { - dest = "mysql_replication/${name}/slave_init_commands"; + secrets.keys = lib.listToAttrs (lib.flatten (lib.mapAttrsToList (name: hcfg: [ + (lib.nameValuePair "mysql_replication/${name}/slave_init_commands" { user = "mysql"; group = "mysql"; permissions = "0400"; @@ -91,9 +90,8 @@ in CHANGE MASTER TO master_host="${hcfg.host}", master_port=${hcfg.port}, master_user="${hcfg.user}", master_password="${hcfg.password}", master_ssl=1, master_use_gtid=slave_pos; START SLAVE; ''; - } - { - dest = "mysql_replication/${name}/mysqldump_remote"; + }) + (lib.nameValuePair "mysql_replication/${name}/mysqldump_remote" { permissions = "0400"; user = "root"; group = "root"; @@ -102,9 +100,8 @@ in user = ${hcfg.user} password = ${hcfg.password} ''; - } - { - dest = "mysql_replication/${name}/mysqldump"; + }) + (lib.nameValuePair "mysql_replication/${name}/mysqldump" { permissions = "0400"; user = "root"; group = "root"; @@ -113,9 +110,8 @@ in user = ${hcfg.dumpUser} password = ${hcfg.dumpPassword} ''; - } - { - dest = "mysql_replication/${name}/client"; + }) + (lib.nameValuePair "mysql_replication/${name}/client" { permissions = "0400"; user = "mysql"; group = "mysql"; @@ -124,8 +120,8 @@ in user = ${hcfg.dumpUser} password = ${hcfg.dumpPassword} ''; - } - ]) cfg.hosts); + }) + ]) cfg.hosts)); services.cron = { enable = true;