diff options
author | jeschli <jeschli@gmail.com> | 2018-12-28 14:48:30 +0100 |
---|---|---|
committer | jeschli <jeschli@gmail.com> | 2018-12-28 14:48:30 +0100 |
commit | 06b6454af78e8236a67d69cab94f62c32054be47 (patch) | |
tree | 749fd6025d2e799314cf46d51027dc23fb19c7b8 /lass/3modules | |
parent | 8605ac91ae3a3859ab906a5fa2e9b0e3dfcd6e1e (diff) | |
parent | fb254e60949f029cc7cb48764093b49932d0acde (diff) |
Merge branch 'master' of prism.r:stockholm
Diffstat (limited to 'lass/3modules')
-rw-r--r-- | lass/3modules/mysql-backup.nix | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lass/3modules/mysql-backup.nix b/lass/3modules/mysql-backup.nix index d2ae67171..516f96c34 100644 --- a/lass/3modules/mysql-backup.nix +++ b/lass/3modules/mysql-backup.nix @@ -41,7 +41,7 @@ let }; location = mkOption { type = str; - default = "/bku/sql_dumps"; + default = "/backups/sql_dumps"; }; }; })); @@ -51,11 +51,9 @@ let imp = { - #systemd.timers = - # mapAttrs (_: plan: { - # wantedBy = [ "timers.target" ]; - # timerConfig = plan.timerConfig; - #}) cfg.config; + services.mysql.ensureUsers = [ + { ensurePermissions = { "*.*" = "ALL"; }; name = "root"; } + ]; systemd.services = mapAttrs' (_: plan: nameValuePair "mysqlBackup-${plan.name}" { @@ -75,8 +73,10 @@ let start = plan: let - backupScript = plan: db: - "mysqldump -u ${plan.user} ${optionalString (plan.password != null) "-p$(cat ${plan.password})"} ${db} | gzip -c > ${plan.location}/${db}.gz"; + backupScript = plan: db: '' + mkdir -p ${plan.location} + mysqldump -u ${plan.user} ${optionalString (plan.password != null) "-p$(cat ${plan.password})"} ${db} | gzip -c > ${plan.location}/${db}.gz + ''; in pkgs.pkgs.writeDash "mysqlBackup.${plan.name}" '' ${concatMapStringsSep "\n" (backupScript plan) plan.databases} |