pkgs/clerie-backup: Support sftp backend for restic
This commit is contained in:
@@ -60,16 +60,19 @@ let
|
||||
config.sops.secrets."clerie-backup-job-${jobName}".path;
|
||||
repoPath = if jobOptions.repoPath == null then "/${config.networking.hostName}/${jobName}" else jobOptions.repoPath;
|
||||
targetPasswordFile = if targetOptions.passwordFile != null then targetOptions.passwordFile else
|
||||
config.sops.secrets."clerie-backup-target-${targetName}".path;
|
||||
config.sops.secrets."clerie-backup-target-${targetName}".path or null;
|
||||
targetUsername = if targetOptions.username == null then config.networking.hostName else targetOptions.username;
|
||||
in {
|
||||
"clerie-backup/${jobName}-${targetName}/repo_password".source = jobPasswordFile;
|
||||
"clerie-backup/${jobName}-${targetName}/repo_url".text = "${targetOptions.serverUrl}${repoPath}";
|
||||
"clerie-backup/${jobName}-${targetName}/auth_username".text = targetUsername;
|
||||
"clerie-backup/${jobName}-${targetName}/auth_password".source = targetPasswordFile;
|
||||
"clerie-backup/${jobName}-${targetName}/files".text = concatStringsSep "\n" jobOptions.paths;
|
||||
"clerie-backup/${jobName}-${targetName}/excludes".text = concatStringsSep "\n" jobOptions.exclude;
|
||||
}
|
||||
} // (if targetPasswordFile == null then {} else {
|
||||
"clerie-backup/${jobName}-${targetName}/auth_password".source = targetPasswordFile;
|
||||
}) // (if targetOptions.sshKeyFile == null then {} else {
|
||||
"clerie-backup/${jobName}-${targetName}/ssh_key".source = targetOptions.sshKeyFile;
|
||||
})
|
||||
) jobTargetPairs);
|
||||
|
||||
targetOptions = { ... }: {
|
||||
@@ -85,6 +88,10 @@ let
|
||||
serverUrl = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
sshKeyFile = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user