about summary refs log tree commit diff
path: root/modules/services/backup/default.nix
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2023-04-23 19:18:16 -0700
committerFranck Cuny <franck@fcuny.net>2023-04-29 15:04:06 -0700
commit3910ad471cfe5fd64bedb1ac20a69ae8dcfe4435 (patch)
tree6140bfa4cd75bfcc82dadf910d9d97b066f24bc4 /modules/services/backup/default.nix
parenthosts/tahoe: rename account for backup and enable sftp for it (diff)
downloadworld-3910ad471cfe5fd64bedb1ac20a69ae8dcfe4435.tar.gz
modules/restic: handle extra options and remove unused settings
For a host to use a repository from a remote machine, we need to
configure options for the CLI. For this we add a new setting
`extraOptions` where we can define the sftp command.

Remove the setting for the user that will run restic, since it's always
'root' in our situation.

Clean some descriptions.
Diffstat (limited to 'modules/services/backup/default.nix')
-rw-r--r--modules/services/backup/default.nix20
1 files changed, 9 insertions, 11 deletions
diff --git a/modules/services/backup/default.nix b/modules/services/backup/default.nix
index d681a07..3481f3f 100644
--- a/modules/services/backup/default.nix
+++ b/modules/services/backup/default.nix
@@ -12,7 +12,7 @@ in
 
     repository = mkOption {
       type = types.str;
-      example = "/data/slow/backups/system";
+      example = "/data/slow/backups/hosts";
       description = "The repository to back up to";
     };
 
@@ -22,6 +22,13 @@ in
       description = "Read the repository's password from this path";
     };
 
+    extraOptions = mkOption {
+      type = with types; listOf str;
+      default = [ ];
+      example = [ "sftp.command='ssh ....'" ];
+      description = "Extra options to restic";
+    };
+
     paths = mkOption {
       type = with types; listOf str;
       default = [ ];
@@ -72,15 +79,6 @@ in
         When to run the backup. See man systemd.timer for details.
       '';
     };
-
-    user = mkOption {
-      type = types.str;
-      default = "root";
-      description = ''
-        As which user the backup should run.
-      '';
-      example = "postgresql";
-    };
   };
 
   config = lib.mkIf cfg.enable {
@@ -91,7 +89,7 @@ in
         ++ lib.optional (builtins.length cfg.exclude != 0) excludeArg;
       # Take care of creating the repository if it doesn't exist
       initialize = true;
-      inherit (cfg) passwordFile pruneOpts timerConfig repository user;
+      inherit (cfg) passwordFile pruneOpts timerConfig repository extraOptions;
     };
   };
 }