restic: Simplify timerConfig

The upstream restic module validates the types anyway, so I can drop the
ugly expression to copy the option.
pull/48/head
Simon Bruder 2021-02-28 12:07:18 +01:00
parent 6a8904011a
commit d7272e9db3
Signed by: simon
GPG Key ID: 8D3C82F9F309F8EC
1 changed files with 8 additions and 15 deletions

View File

@ -1,4 +1,4 @@
{ pkgs, config, lib, options, ... }:
{ pkgs, config, lib, ... }:
let
cfg = config.sbruder.restic;
@ -41,20 +41,13 @@ in
{
options.sbruder.restic = {
enable = lib.mkEnableOption "restic";
timerConfig = lib.recursiveUpdate
((lib.elemAt
(lib.elemAt
options.services.restic.backups.type.getSubModules
0
).imports
0)
{ name = ""; }).options.timerConfig
{
default = {
OnCalendar = "20:00";
RandomizedDelaySec = "2h";
};
timerConfig = lib.mkOption {
type = with lib.types; attrsOf str;
default = {
OnCalendar = "20:00";
RandomizedDelaySec = "2h";
};
};
extraPaths = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
@ -74,6 +67,7 @@ in
services.restic.backups.system = {
inherit repository;
inherit (cfg) timerConfig;
passwordFile = config.krops.secrets.restic-password.path;
s3CredentialsFile = config.krops.secrets.restic-s3.path;
paths = [
@ -87,7 +81,6 @@ in
"--exclude-file=${excludesFile}"
"--verbose"
];
timerConfig = cfg.timerConfig;
};
systemd.services."restic-backups-system".serviceConfig = {