fix(borg): make job defaults overridable
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
f4991b721e
commit
bd5216cc87
2 changed files with 11 additions and 10 deletions
|
@ -2,7 +2,9 @@
|
||||||
config,
|
config,
|
||||||
rwPath,
|
rwPath,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
|
secrets = config.sops.secrets;
|
||||||
|
in {
|
||||||
# FIXME: crashes when building
|
# FIXME: crashes when building
|
||||||
|
|
||||||
# This should only be ran when an update is needed
|
# This should only be ran when an update is needed
|
||||||
|
@ -66,7 +68,7 @@
|
||||||
"${toString ./.}/Caddyfile:/etc/caddy/Caddyfile:ro"
|
"${toString ./.}/Caddyfile:/etc/caddy/Caddyfile:ro"
|
||||||
];
|
];
|
||||||
|
|
||||||
env_file = [config.sops.secrets.caddy-cloudflare.path];
|
env_file = [secrets.caddy-cloudflare.path];
|
||||||
environment = {
|
environment = {
|
||||||
CLOUDFLARE_EMAIL = "matt@nelim.rg";
|
CLOUDFLARE_EMAIL = "matt@nelim.rg";
|
||||||
ACME_AGREE = "true";
|
ACME_AGREE = "true";
|
||||||
|
|
|
@ -10,7 +10,6 @@ with lib; let
|
||||||
in {
|
in {
|
||||||
# Make this file declare default settings
|
# Make this file declare default settings
|
||||||
options.services.borgbackup = {
|
options.services.borgbackup = {
|
||||||
#
|
|
||||||
defaults = mkOption {
|
defaults = mkOption {
|
||||||
type = types.attrs;
|
type = types.attrs;
|
||||||
};
|
};
|
||||||
|
@ -36,11 +35,11 @@ in {
|
||||||
|
|
||||||
services.borgbackup = {
|
services.borgbackup = {
|
||||||
defaults = {
|
defaults = {
|
||||||
user = "borg";
|
user = mkDefault "borg";
|
||||||
environment = {BORG_RSH = "ssh -i ${secrets.borg-ssh.path}";};
|
environment = mkDefault {BORG_RSH = "ssh -i ${secrets.borg-ssh.path}";};
|
||||||
|
|
||||||
repo = "ssh://matt@pve/data/backups/borg";
|
repo = mkDefault "ssh://matt@pve/data/backups/borg";
|
||||||
encryption = {
|
encryption = mkDefault {
|
||||||
mode = "repokey";
|
mode = "repokey";
|
||||||
passCommand = let
|
passCommand = let
|
||||||
cat = "${pkgs.coreutils}/bin/cat";
|
cat = "${pkgs.coreutils}/bin/cat";
|
||||||
|
@ -49,11 +48,11 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
# Run every 3 hours
|
# Run every 3 hours
|
||||||
startAt = "00/3:00";
|
startAt = mkDefault "00/3:00";
|
||||||
compression = "auto,lzma";
|
compression = mkDefault "auto,lzma";
|
||||||
};
|
};
|
||||||
|
|
||||||
jobs = mapAttrs (_: v: v // cfg.defaults) cfg.configs;
|
jobs = mapAttrs (_: v: cfg.defaults // v) cfg.configs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue