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