Generating repository config


I’m running kopia cli-only and would I’d like to centrally manage the repository configuration for multiple machines.

As far as I can tell, there are basically three options with different downsides:

  1. Generate a repository.config directly without calling kopia
  2. Call kopia repository connect as needed when deploying the machines
  3. Generate the repository.config once, then configure the machines via kopia repository connect from-config

Of these, 3. seems like the best option right now. I can’t find any documentation on the config format or how stable it is, so I’ve mostly moved away from that option. And running kopia repository connect x always requires passing credentials on the command line, which I’d like to avoid. Using connect from-config avoids these problems, but means I have to treat the config as an opaque blob and can’t do any sanity checks before rolling it out. It also doesn’t work well if the credentials to access the repo differ between machines.

Is there a good way to do this that others have already tried? For my own usage I can live with some hacks, but ideally I’d like to try and write a NixOS module to declaratively configure kopia that could be upstreamed.

Additional question: How does one choose a cache directory and which invariants need to be maintained?
As far as I understand, the default cache directory is chosen based on a repository identifier and a subset of the repository config. If I explicitly specify a cache directory when connecting to the repo and some configuration changed since the local cache was created, do I need to create a new one? I assume at the very least the same cache directory can’t be used for more than one repo…

From looking at the code it seems to be just a hash of both the unique repo ID and repo config path?