Compare commits

..

2 commits

View file

@ -1,11 +1,9 @@
{ config, lib, options, pkgs, ... }: let { config, lib, pkgs, utils, ... }: let
cfg = config.kyouma.restic; cfg = config.kyouma.restic;
in { in {
options.kyouma.restic = let options.kyouma.restic = let
inherit (lib) mkOption types; inherit (lib) mkOption types;
in { in {
inherit (options.services.restic.backups.type.getSubOptions [])
timerConfig backupPrepareCommand backupCleanupCommand;
enable = lib.mkEnableOption "Enable restic backup"; enable = lib.mkEnableOption "Enable restic backup";
paths = mkOption { paths = mkOption {
description = "paths to backup"; description = "paths to backup";
@ -42,6 +40,27 @@ in {
type = types.nonEmptyStr; type = types.nonEmptyStr;
default = "${config.networking.hostName}-backup"; default = "${config.networking.hostName}-backup";
}; };
timerConfig = mkOption {
description = "timer config";
type = with types; nullOr (attrsOf utils.systemdUtils.unitOptions.unitOption);
default = {
OnCalendar = "daily";
Persistent = true;
};
};
# FIXME: Can these be just inherited?
backupPrepareCommand = mkOption {
description = "preparation script";
type = with types; nullOr str;
default = null;
};
backupCleanupCommand = mkOption {
description = "cleanup script";
type = with types; nullOr str;
default = null;
};
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
sops.secrets."restic/${cfg.remoteUser}/password" = { sops.secrets."restic/${cfg.remoteUser}/password" = {