tasks/backup-archive: refactor

This commit is contained in:
Gabriel Arazas 2022-08-20 14:15:16 +08:00
parent c53618add6
commit f5d0367dcb

View File

@ -42,13 +42,14 @@ in {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
sops.secrets = let sops.secrets = let
borgSecretsPath = key: "borg-backup/${key}";
getKey = key: { getKey = key: {
inherit key; inherit key;
sopsFile = lib.getSecret "backup-archive.yaml"; sopsFile = lib.getSecret "backup-archive.yaml";
name = "borg-backup/${key}"; name = borgSecretsPath key;
}; };
getSecrets = keys: getSecrets = keys:
lib.listToAttrs (lib.lists.map (key: lib.nameValuePair key (getKey key)) keys); lib.listToAttrs (lib.lists.map (key: lib.nameValuePair (borgSecretsPath key) (getKey key)) keys);
in getSecrets [ in getSecrets [
"borg-patterns/home" "borg-patterns/home"
"borg-patterns/etc" "borg-patterns/etc"