Skip to content

Commit 218cdc0

Browse files
jakubgsPetarKirov
authored andcommitted
config(lido-withdrawals): add missing timer, fix type
Because of missing Type=oneshot the service keeps failing when system is being activated with error like this: ``` 🚀 Lido Withdrawals Automation developed by Stakely.io - 2023 v1.0.1 Step 1: Checking environment variables and asking for missing values... Cannot read properties of undefined (reading 'trim') ``` Signed-off-by: Jakub Sokołowski <[email protected]>
1 parent 2fc016c commit 218cdc0

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

modules/lido/withdrawals-automation/default.nix

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
{
1818
options.services.lido-withdrawals-automation = with lib; {
1919
enable = mkEnableOption (lib.mdDoc "Lido Withdrawals Automation");
20+
timerFrequency = mkOption {
21+
type = types.str;
22+
default = "daily";
23+
example = "hourly";
24+
};
2025
args = {
2126
percentage = mkOption {
2227
type = types.nullOr types.int;
@@ -78,8 +83,18 @@
7883
};
7984
};
8085
};
81-
config = {
82-
systemd.services.lido-withdrawals-automation = lib.mkIf cfg.enable {
86+
config = lib.mkIf cfg.enable {
87+
88+
systemd.timers.lido-withdrawals-automation = {
89+
wantedBy = ["timers.target"];
90+
partOf = ["lido-withdrawals-automation.service"];
91+
timerConfig = {
92+
OnCalendar = cfg.timerFrequency;
93+
Unit = "lido-withdrawals-automation.service";
94+
};
95+
};
96+
97+
systemd.services.lido-withdrawals-automation = {
8398
description = "Lido Withdrawals Automation";
8499

85100
wantedBy = [ "multi-user.target" ];
@@ -90,6 +105,7 @@
90105

91106
serviceConfig = lib.mkMerge [
92107
{
108+
Type = "oneshot";
93109
Group = "lido";
94110
ExecStart = lib.getExe (
95111
pkgs.writeShellApplication {

0 commit comments

Comments
 (0)