diff options
author | Felix Buehler <account@buehler.rocks> | 2023-03-19 21:44:31 +0100 |
---|---|---|
committer | Felix Buehler <account@buehler.rocks> | 2023-04-07 13:38:33 +0200 |
commit | 327b0cff7aedc20a148d245b1182f43800acc1f5 (patch) | |
tree | a498ae1b2dd2289310483d81345903d7e9123cb7 /nixos/modules/services/backup | |
parent | b392d9b827cf4bb52141ab86e4202ec340f0b181 (diff) | |
download | nixlib-327b0cff7aedc20a148d245b1182f43800acc1f5.tar nixlib-327b0cff7aedc20a148d245b1182f43800acc1f5.tar.gz nixlib-327b0cff7aedc20a148d245b1182f43800acc1f5.tar.bz2 nixlib-327b0cff7aedc20a148d245b1182f43800acc1f5.tar.lz nixlib-327b0cff7aedc20a148d245b1182f43800acc1f5.tar.xz nixlib-327b0cff7aedc20a148d245b1182f43800acc1f5.tar.zst nixlib-327b0cff7aedc20a148d245b1182f43800acc1f5.zip |
treewide: use more lib.optionalString
Diffstat (limited to 'nixos/modules/services/backup')
-rw-r--r-- | nixos/modules/services/backup/mysql-backup.nix | 2 | ||||
-rw-r--r-- | nixos/modules/services/backup/restic.nix | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/nixos/modules/services/backup/mysql-backup.nix b/nixos/modules/services/backup/mysql-backup.nix index 289291c6bd2f..9fbc599cd41a 100644 --- a/nixos/modules/services/backup/mysql-backup.nix +++ b/nixos/modules/services/backup/mysql-backup.nix @@ -20,7 +20,7 @@ let ''; backupDatabaseScript = db: '' dest="${cfg.location}/${db}.gz" - if ${mariadb}/bin/mysqldump ${if cfg.singleTransaction then "--single-transaction" else ""} ${db} | ${gzip}/bin/gzip -c > $dest.tmp; then + if ${mariadb}/bin/mysqldump ${optionalString cfg.singleTransaction "--single-transaction"} ${db} | ${gzip}/bin/gzip -c > $dest.tmp; then mv $dest.tmp $dest echo "Backed up to $dest" else diff --git a/nixos/modules/services/backup/restic.nix b/nixos/modules/services/backup/restic.nix index ca796cf7797e..d19b98a3e4bb 100644 --- a/nixos/modules/services/backup/restic.nix +++ b/nixos/modules/services/backup/restic.nix @@ -300,7 +300,7 @@ in filesFromTmpFile = "/run/restic-backups-${name}/includes"; backupPaths = if (backup.dynamicFilesFrom == null) - then if (backup.paths != null) then concatStringsSep " " backup.paths else "" + then optionalString (backup.paths != null) (concatStringsSep " " backup.paths) else "--files-from ${filesFromTmpFile}"; pruneCmd = optionals (builtins.length backup.pruneOpts > 0) [ (resticCmd + " forget --prune " + (concatStringsSep " " backup.pruneOpts)) |