diff --git a/modules/nixos/dgn-backups/default.nix b/modules/nixos/dgn-backups/default.nix index e79f076..290bcb0 100644 --- a/modules/nixos/dgn-backups/default.nix +++ b/modules/nixos/dgn-backups/default.nix @@ -11,7 +11,12 @@ }: let - inherit (lib) mkEnableOption mkOption remove; + inherit (lib) + getExe' + mkEnableOption + mkOption + remove + ; inherit (lib.types) attrs @@ -93,7 +98,7 @@ in "${db}-db".settings = { user = "postgres"; command = [ - "${lib.getExe' config.services.postgresql.package "pg_dump"}" + (getExe' config.services.postgresql.package "pg_dump") db ]; }; @@ -113,6 +118,8 @@ in "storage01" "vault01" "web01" + "web02" + "web03" ]; allowed = [ "put" ]; } diff --git a/modules/nixos/django-apps/default.nix b/modules/nixos/django-apps/default.nix index 60f6eda..eccd91f 100644 --- a/modules/nixos/django-apps/default.nix +++ b/modules/nixos/django-apps/default.nix @@ -732,5 +732,14 @@ in ) config.extraServices) ) cfg.sites); }; + + dgn-backups = { + jobs = mapAttrs' ( + name: _: nameValuePair "dj-${name}" { settings.paths = [ "/var/lib/django-apps/${name}" ]; } + ) cfg.sites; + postgresDatabases = builtins.map (name: "dj-${name}") ( + attrNames (filterAttrs (_: { dbType, ... }: dbType == "postgresql") cfg.sites) + ); + }; }; }