···176176177177- NixOS now defaults to using nsncd (a non-caching reimplementation in Rust) as NSS lookup dispatcher, instead of the buggy and deprecated glibc-provided nscd. If you need to switch back, set `services.nscd.enableNsncd = false`, but please open an issue in nixpkgs so your issue can be fixed.
178178179179+- `services.borgmatic` now allows for multiple configurations, placed in `/etc/borgmatic.d/`, you can define them with `services.borgmatic.configurations`.
180180+179181- The `dnsmasq` service now takes configuration via the
180182 `services.dnsmasq.settings` attribute set. The option
181183 `services.dnsmasq.extraConfig` will be deprecated when NixOS 22.11 reaches
+52-34
nixos/modules/services/backup/borgmatic.nix
···55let
66 cfg = config.services.borgmatic;
77 settingsFormat = pkgs.formats.yaml { };
88+99+ cfgType = with types; submodule {
1010+ freeformType = settingsFormat.type;
1111+ options.location = {
1212+ source_directories = mkOption {
1313+ type = listOf str;
1414+ description = mdDoc ''
1515+ List of source directories to backup (required). Globs and
1616+ tildes are expanded.
1717+ '';
1818+ example = [ "/home" "/etc" "/var/log/syslog*" ];
1919+ };
2020+ repositories = mkOption {
2121+ type = listOf str;
2222+ description = mdDoc ''
2323+ Paths to local or remote repositories (required). Tildes are
2424+ expanded. Multiple repositories are backed up to in
2525+ sequence. Borg placeholders can be used. See the output of
2626+ "borg help placeholders" for details. See ssh_command for
2727+ SSH options like identity file or port. If systemd service
2828+ is used, then add local repository paths in the systemd
2929+ service file to the ReadWritePaths list.
3030+ '';
3131+ example = [
3232+ "ssh://user@backupserver/./sourcehostname.borg"
3333+ "ssh://user@backupserver/./{fqdn}"
3434+ "/var/local/backups/local.borg"
3535+ ];
3636+ };
3737+ };
3838+ };
3939+840 cfgfile = settingsFormat.generate "config.yaml" cfg.settings;
99-in {
4141+in
4242+{
1043 options.services.borgmatic = {
1111- enable = mkEnableOption (lib.mdDoc "borgmatic");
4444+ enable = mkEnableOption (mdDoc "borgmatic");
12451346 settings = mkOption {
1414- description = lib.mdDoc ''
4747+ description = mdDoc ''
1548 See https://torsion.org/borgmatic/docs/reference/configuration/
1649 '';
1717- type = types.submodule {
1818- freeformType = settingsFormat.type;
1919- options.location = {
2020- source_directories = mkOption {
2121- type = types.listOf types.str;
2222- description = lib.mdDoc ''
2323- List of source directories to backup (required). Globs and
2424- tildes are expanded.
2525- '';
2626- example = [ "/home" "/etc" "/var/log/syslog*" ];
2727- };
2828- repositories = mkOption {
2929- type = types.listOf types.str;
3030- description = lib.mdDoc ''
3131- Paths to local or remote repositories (required). Tildes are
3232- expanded. Multiple repositories are backed up to in
3333- sequence. Borg placeholders can be used. See the output of
3434- "borg help placeholders" for details. See ssh_command for
3535- SSH options like identity file or port. If systemd service
3636- is used, then add local repository paths in the systemd
3737- service file to the ReadWritePaths list.
3838- '';
3939- example = [
4040- "user@backupserver:sourcehostname.borg"
4141- "user@backupserver:{fqdn}"
4242- ];
4343- };
4444- };
4545- };
5050+ default = null;
5151+ type = types.nullOr cfgType;
5252+ };
5353+5454+ configurations = mkOption {
5555+ description = mdDoc ''
5656+ Set of borgmatic configurations, see https://torsion.org/borgmatic/docs/reference/configuration/
5757+ '';
5858+ default = { };
5959+ type = types.attrsOf cfgType;
4660 };
4761 };
4862···50645165 environment.systemPackages = [ pkgs.borgmatic ];
52665353- environment.etc."borgmatic/config.yaml".source = cfgfile;
6767+ environment.etc = (optionalAttrs (cfg.settings != null) { "borgmatic/config.yaml".source = cfgfile; }) //
6868+ mapAttrs'
6969+ (name: value: nameValuePair
7070+ "borgmatic.d/${name}.yaml"
7171+ { source = settingsFormat.generate "${name}.yaml" value; })
7272+ cfg.configurations;
54735574 systemd.packages = [ pkgs.borgmatic ];
5656-5775 };
5876}