25 lines
601 B
Nix
25 lines
601 B
Nix
|
{ config, lib, pkgs, ... }:
|
||
|
let nathan = config.nathan;
|
||
|
in with lib; {
|
||
|
config = mkMerge [
|
||
|
(mkIf nathan.services.postgresql.enable {
|
||
|
services.postgresql = {
|
||
|
enable = true;
|
||
|
settings = { };
|
||
|
};
|
||
|
})
|
||
|
(mkIf
|
||
|
(nathan.services.postgresql.enable && nathan.services.postgresql.backup) {
|
||
|
# Backup postgres
|
||
|
services.postgresqlBackup = {
|
||
|
enable = true;
|
||
|
compression = "zstd";
|
||
|
compressionLevel = 6;
|
||
|
backupAll = true;
|
||
|
# Every morning at 4 AM
|
||
|
startAt = "*-*-* 4:00:00";
|
||
|
};
|
||
|
})
|
||
|
];
|
||
|
}
|