diff --git a/modules/services/borgmatic/default.nix b/modules/services/borgmatic/default.nix index 609bfec..309b852 100644 --- a/modules/services/borgmatic/default.nix +++ b/modules/services/borgmatic/default.nix @@ -1,33 +1,31 @@ { config, lib, pkgs, inputs, ... }: -with lib; - let cfg = config.modules.services.borgmatic; hostname = config.networking.hostName; in { options.modules.services.borgmatic = { - enable = mkOption { + enable = lib.mkOption { default = false; example = true; - description = mdDoc "Enable backups on this host with `borgmatic`"; + description = lib.mdDoc "Enable backups on this host with `borgmatic`"; }; - directories = mkOption { - type = types.listOf types.str; + directories = lib.mkOption { + type = lib.types.listOf lib.types.str; default = []; example = [ "/home/jordan/Documents" ]; - description = mdDoc "List of directories to backup"; + description = lib.mdDoc "List of directories to backup"; }; - repoPath = mkOption { - type = types.str; + repoPath = lib.mkOption { + type = lib.types.str; example = "ssh://example@example.repo.borgbase.com/./repo"; - description = mdDoc "Destination borg repository for backup"; + description = lib.mdDoc "Destination borg repository for backup"; }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { age.secrets."passwords/services/borg/${hostname}-passphrase" = { file = "${inputs.secrets}/passwords/services/borg/${hostname}-passphrase.age"; }; @@ -47,6 +45,9 @@ in { }; }; + # Add `pg_dumpall` to unit environment + systemd.services.borgmatic.path = [ pkgs.postgresql ]; + # Without this override, `cat` is unavailable for `encryption_passcommand` systemd.services.borgmatic.confinement.fullUnit = true; };