fix(borg): make job defaults overridable
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-01-06 22:47:50 -05:00
parent f4991b721e
commit bd5216cc87
2 changed files with 11 additions and 10 deletions

View file

@ -2,7 +2,9 @@
config,
rwPath,
...
}: {
}: let
secrets = config.sops.secrets;
in {
# FIXME: crashes when building
# This should only be ran when an update is needed
@ -66,7 +68,7 @@
"${toString ./.}/Caddyfile:/etc/caddy/Caddyfile:ro"
];
env_file = [config.sops.secrets.caddy-cloudflare.path];
env_file = [secrets.caddy-cloudflare.path];
environment = {
CLOUDFLARE_EMAIL = "matt@nelim.rg";
ACME_AGREE = "true";

View file

@ -10,7 +10,6 @@ with lib; let
in {
# Make this file declare default settings
options.services.borgbackup = {
#
defaults = mkOption {
type = types.attrs;
};
@ -36,11 +35,11 @@ in {
services.borgbackup = {
defaults = {
user = "borg";
environment = {BORG_RSH = "ssh -i ${secrets.borg-ssh.path}";};
user = mkDefault "borg";
environment = mkDefault {BORG_RSH = "ssh -i ${secrets.borg-ssh.path}";};
repo = "ssh://matt@pve/data/backups/borg";
encryption = {
repo = mkDefault "ssh://matt@pve/data/backups/borg";
encryption = mkDefault {
mode = "repokey";
passCommand = let
cat = "${pkgs.coreutils}/bin/cat";
@ -49,11 +48,11 @@ in {
};
# Run every 3 hours
startAt = "00/3:00";
compression = "auto,lzma";
startAt = mkDefault "00/3:00";
compression = mkDefault "auto,lzma";
};
jobs = mapAttrs (_: v: v // cfg.defaults) cfg.configs;
jobs = mapAttrs (_: v: cfg.defaults // v) cfg.configs;
};
};
}