diff options
author | Robert Obryk <robryk@gmail.com> | 2023-11-01 21:13:11 +0100 |
---|---|---|
committer | Robert Obryk <robryk@gmail.com> | 2023-11-01 21:18:56 +0100 |
commit | 536401e90aa3c74d2f0226f4e55a005dc8f9eac3 (patch) | |
tree | 1a5a4d18ca3b7811fe40fead03a5a585630ce3bc /nixos/modules/services/backup | |
parent | 9ec80ed610eaaffd7bc1c72d4c24896214aa86ec (diff) |
nixos/restic: fix #264696 and add a regression test
Make sure that preStart and postStop are included in all cases when they are nonempty.
Diffstat (limited to 'nixos/modules/services/backup')
-rw-r--r-- | nixos/modules/services/backup/restic.nix | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/nixos/modules/services/backup/restic.nix b/nixos/modules/services/backup/restic.nix index 49a55d0560140..fcdd3082f5a6c 100644 --- a/nixos/modules/services/backup/restic.nix +++ b/nixos/modules/services/backup/restic.nix @@ -345,7 +345,7 @@ in } // optionalAttrs (backup.environmentFile != null) { EnvironmentFile = backup.environmentFile; }; - } // optionalAttrs (backup.initialize || backup.dynamicFilesFrom != null || backup.backupPrepareCommand != null) { + } // optionalAttrs (backup.initialize || doBackup || backup.backupPrepareCommand != null) { preStart = '' ${optionalString (backup.backupPrepareCommand != null) '' ${pkgs.writeScript "backupPrepareCommand" backup.backupPrepareCommand} @@ -360,12 +360,12 @@ in ${pkgs.writeScript "dynamicFilesFromScript" backup.dynamicFilesFrom} >> ${filesFromTmpFile} ''} ''; - } // optionalAttrs (backup.dynamicFilesFrom != null || backup.backupCleanupCommand != null) { + } // optionalAttrs (doBackup || backup.backupCleanupCommand != null) { postStop = '' ${optionalString (backup.backupCleanupCommand != null) '' ${pkgs.writeScript "backupCleanupCommand" backup.backupCleanupCommand} ''} - ${optionalString (backup.dynamicFilesFrom != null) '' + ${optionalString doBackup '' rm ${filesFromTmpFile} ''} ''; |