restic: Simplify timerConfig

The upstream restic module validates the types anyway, so I can drop the
ugly expression to copy the option.
This commit is contained in:
Simon Bruder 2021-02-28 12:07:18 +01:00
parent 6a8904011a
commit d7272e9db3
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC

View file

@ -1,4 +1,4 @@
{ pkgs, config, lib, options, ... }:
{ pkgs, config, lib, ... }:
let
cfg = config.sbruder.restic;
@ -41,15 +41,8 @@ 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
{
timerConfig = lib.mkOption {
type = with lib.types; attrsOf str;
default = {
OnCalendar = "20:00";
RandomizedDelaySec = "2h";
@ -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 = {