Skip to content

Commit

Permalink
borgmatic: Allow top-level extra options
Browse files Browse the repository at this point in the history
Fix #3760.
  • Loading branch information
DamienCassou committed Mar 20, 2023
1 parent 9e3c2b3 commit aed4339
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/programs/borgmatic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,15 @@ let

extraConfig = extraConfigOption;
};

extraConfig = extraConfigOption;
};
};

removeNullValues = attrSet: filterAttrs (key: value: value != null) attrSet;

writeConfig = config:
generators.toYAML { } {
generators.toYAML { } ({
location = removeNullValues {
source_directories = config.location.sourceDirectories;
repositories = config.location.repositories;
Expand All @@ -145,7 +147,7 @@ let
} // config.retention.extraConfig;
consistency = removeNullValues { checks = config.consistency.checks; }
// config.consistency.extraConfig;
};
} // config.extraConfig);
in {
meta.maintainers = [ maintainers.DamienCassou ];

Expand Down
8 changes: 8 additions & 0 deletions tests/modules/programs/borgmatic/basic-configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ in {

extraConfig = { prefix = "hostname"; };
};

extraConfig = {
hooks = {
before_actions = [ "echo Starting actions." ];
};
};
};
};
};
Expand Down Expand Up @@ -96,6 +102,8 @@ in {
}"
expectations[consistency.prefix]="${backups.main.consistency.extraConfig.prefix}"
expectations[hooks.before_actions[0]]="echo Starting actions."
yq=${pkgs.yq-go}/bin/yq
for filter in "''${!expectations[@]}"; do
Expand Down

0 comments on commit aed4339

Please sign in to comment.