How to write a nix function that create a borgbackup job?

I do not know how it works under the hood, but mkMerge takes a list of attrsets and merges them recursively, while taking into account the types defined in the NixOS modules when merging values. For example

lib.mkMerge [
  { a = { b = 1; c = [ 2 ]; }; }
  { a = { c = [ 3 ]; }; }
]

will most likely result in

{ a = { b = 1; c = [ 2 3 ]; }; }

because usually options taking a list value will just concatenate the lists.

I do not know if the config key is actually required. This answer explains a bit more about it.

1 Like