From 3910ad471cfe5fd64bedb1ac20a69ae8dcfe4435 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 23 Apr 2023 19:18:16 -0700 Subject: 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. --- modules/services/backup/default.nix | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'modules/services/backup/default.nix') 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; }; }; } -- cgit 1.4.1