1
0

pkgs/clerie-backup: Support sftp backend for restic

This commit is contained in:
2025-11-16 19:38:50 +01:00
parent 1ab3ae3769
commit 971fb88d97
2 changed files with 29 additions and 13 deletions

View File

@@ -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;
};
};
};