From 3eb015c186755476dd022e3e6e402df0a3eb3f97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Mon, 31 Oct 2022 20:30:25 +0100 Subject: [PATCH] Dump postgres databases for backups --- flake.nix | 6 +++++- modules/backup.nix | 12 ++++++++++++ modules/c3d2.nix | 6 ------ 3 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 modules/backup.nix diff --git a/flake.nix b/flake.nix index 63b682f6..08757593 100644 --- a/flake.nix +++ b/flake.nix @@ -967,9 +967,13 @@ c3d2 = { imports = [ sops-nix.nixosModule + ./modules/audio-server.nix + ./modules/autoupdate.nix + ./modules/backup.nix ./modules/c3d2.nix ./modules/nncp.nix - ./modules/autoupdate.nix + ./modules/logging.nix + ./modules/stats.nix ]; c3d2.hosts = hostRegistry.hosts; c3d2.users = import ./users.nix; diff --git a/modules/backup.nix b/modules/backup.nix new file mode 100644 index 00000000..f913c7d8 --- /dev/null +++ b/modules/backup.nix @@ -0,0 +1,12 @@ +{ config, ... }: + +{ + config.services.postgresqlBackup = { + enable = config.services.postgresql.enable; + backupAll = true; + compression = "zsdt"; + compressionLevel = 9; + pgdumpOptions = "--create --clean"; + startAt = "*-*-* 06:00:00"; + }; +} diff --git a/modules/c3d2.nix b/modules/c3d2.nix index fb7296d9..230f234d 100644 --- a/modules/c3d2.nix +++ b/modules/c3d2.nix @@ -37,12 +37,6 @@ let toHqPrivateAddress = toIpv6Address hqPrefix64; in { - imports = [ - ./stats.nix - ./audio-server.nix - ./logging.nix - ]; - options.c3d2 = with lib; { acmeEmail = mkOption { type = types.str;