From 0457c307872f1d92d1c3dc0592f7fae0bb174a8c Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Thu, 6 Jun 2019 09:57:14 +0200 Subject: Allow a postgres package per pg_dump command To improve modularity. --- modules/apps/pgbackup.nix | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'modules') diff --git a/modules/apps/pgbackup.nix b/modules/apps/pgbackup.nix index a0c1f56..420e72e 100644 --- a/modules/apps/pgbackup.nix +++ b/modules/apps/pgbackup.nix @@ -29,6 +29,7 @@ let command = sub { + package = default pkgs.postgresql package; blobs = optional bool; clean = optional bool; compress = default 9 int; @@ -65,6 +66,7 @@ let args = filterAttrs (n: v: v != null && n != "_module" + && n != "package" && (n == "host" -> v != "localhost") && (n == "jobs" -> o.format == "directory") # XXX will use pigz for others: @@ -77,10 +79,9 @@ let else if isString v then "--${k}='${v}'" else "--${k}=${toString v}" ; - # XXX: Use the latest pg_dump: pg_dump = pkgs.writeBashScript name '' ${optionalString (cfg.pgpass != null) "export PGPASSFILE='${cfg.pgpass}'"} - exec ${cfg.package}/bin/pg_dump \ + exec ${o.package}/bin/pg_dump \ ${concatMapAttrsSep " " mkArg args} \ "$@" ''; @@ -257,12 +258,6 @@ let in { options.nixsap.apps.pgbackup = { - package = mkOption { - description = "PostgreSQL package providing pg_dump"; - type = package; - default = pkgs.postgresql; - }; - user = mkOption { description = "User to run as"; default = "pgbackup"; -- cgit v1.2.3