modules/backup: Lookups passwords in sops too
This commit is contained in:
parent
4cf47229a4
commit
6c4e2de9bb
@ -22,9 +22,13 @@ let
|
|||||||
);
|
);
|
||||||
|
|
||||||
backupServiceUnits = listToAttrs (map ({jobName, jobOptions, targetName, targetOptions}: let
|
backupServiceUnits = listToAttrs (map ({jobName, jobOptions, targetName, targetOptions}: let
|
||||||
jobPasswordFile = if jobOptions.passwordFile == null then config.age.secrets."clerie-backup-job-${jobName}".path else jobOptions.passwordFile;
|
jobPasswordFile = if jobOptions.passwordFile != null then jobOptions.passwordFile else
|
||||||
|
if builtins.elem "clerie-backup-job-${jobName}" (attrNames config.sops.secrets) then config.sops.secrets."clerie-backup-job-${jobName}".path else
|
||||||
|
config.age.secrets."clerie-backup-job-${jobName}".path;
|
||||||
repoPath = if jobOptions.repoPath == null then "/${config.networking.hostName}/${jobName}" else jobOptions.repoPath;
|
repoPath = if jobOptions.repoPath == null then "/${config.networking.hostName}/${jobName}" else jobOptions.repoPath;
|
||||||
targetPasswordFile = if targetOptions.passwordFile == null then config.age.secrets."clerie-backup-target-${targetName}".path else targetOptions.passwordFile;
|
targetPasswordFile = if targetOptions.passwordFile != null then targetOptions.passwordFile else
|
||||||
|
if builtins.elem "clerie-backup-target-${targetName}" (attrNames config.sops.secrets) then config.sops.secrets."clerie-backup-target-${targetName}".path else
|
||||||
|
config.age.secrets."clerie-backup-target-${targetName}".path;
|
||||||
targetUsername = if targetOptions.username == null then config.networking.hostName else targetOptions.username;
|
targetUsername = if targetOptions.username == null then config.networking.hostName else targetOptions.username;
|
||||||
in
|
in
|
||||||
nameValuePair "clerie-backup-${jobName}-${targetName}" {
|
nameValuePair "clerie-backup-${jobName}-${targetName}" {
|
||||||
@ -68,9 +72,13 @@ let
|
|||||||
) jobTargetPairs);
|
) jobTargetPairs);
|
||||||
|
|
||||||
backupCommands = map ({jobName, jobOptions, targetName, targetOptions}: let
|
backupCommands = map ({jobName, jobOptions, targetName, targetOptions}: let
|
||||||
jobPasswordFile = if jobOptions.passwordFile == null then config.age.secrets."clerie-backup-job-${jobName}".path else jobOptions.passwordFile;
|
jobPasswordFile = if jobOptions.passwordFile != null then jobOptions.passwordFile else
|
||||||
|
if builtins.elem "clerie-backup-job-${jobName}" (attrNames config.sops.secrets) then config.sops.secrets."clerie-backup-job-${jobName}".path else
|
||||||
|
config.age.secrets."clerie-backup-job-${jobName}".path;
|
||||||
repoPath = if jobOptions.repoPath == null then "/${config.networking.hostName}/${jobName}" else jobOptions.repoPath;
|
repoPath = if jobOptions.repoPath == null then "/${config.networking.hostName}/${jobName}" else jobOptions.repoPath;
|
||||||
targetPasswordFile = if targetOptions.passwordFile == null then config.age.secrets."clerie-backup-target-${targetName}".path else targetOptions.passwordFile;
|
targetPasswordFile = if targetOptions.passwordFile != null then targetOptions.passwordFile else
|
||||||
|
if builtins.elem "clerie-backup-target-${targetName}" (attrNames config.sops.secrets) then config.sops.secrets."clerie-backup-target-${targetName}".path else
|
||||||
|
config.age.secrets."clerie-backup-target-${targetName}".path;
|
||||||
targetUsername = if targetOptions.username == null then config.networking.hostName else targetOptions.username;
|
targetUsername = if targetOptions.username == null then config.networking.hostName else targetOptions.username;
|
||||||
in pkgs.writeShellApplication {
|
in pkgs.writeShellApplication {
|
||||||
name = "clerie-backup-${jobName}-${targetName}";
|
name = "clerie-backup-${jobName}-${targetName}";
|
||||||
|
Loading…
Reference in New Issue
Block a user