diff --git a/modules/nixos/services/wanikani-stats/default.nix b/modules/nixos/services/wanikani-stats/default.nix index 0731dda..efbac49 100644 --- a/modules/nixos/services/wanikani-stats/default.nix +++ b/modules/nixos/services/wanikani-stats/default.nix @@ -74,37 +74,41 @@ in config.services.wanikani-stats.port ]; - systemd.services.wanikani-stats = { - description = "WaniKani Stats Service"; - after = [ "network.target" ]; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - Type = "simple"; - ExecStart = "${lib.getExe wanikani-stats-flask}"; - StateDirectory = "/var/lib/wanikani-stats"; - Restart = "on-failure"; - User = "root"; - Group = "root"; - }; - }; + systemd = { + services = { + wanikani-stats = { + description = "WaniKani Stats Service"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "simple"; + ExecStart = "${lib.getExe wanikani-stats-flask}"; + StateDirectory = "/var/lib/wanikani-stats"; + Restart = "on-failure"; + User = "root"; + Group = "root"; + }; + }; - # Timer to restart the service every 12 hours - systemd.services.wanikani-stats-restart = { - description = "Restart WaniKani Stats Service"; - serviceConfig = { - Type = "oneshot"; - ExecStart = "${pkgs.systemd}/bin/systemctl restart wanikani-stats.service"; - User = "root"; + # Timer to restart the service every 12 hours + wanikani-stats-restart = { + description = "Restart WaniKani Stats Service"; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.systemd}/bin/systemctl restart wanikani-stats.service"; + User = "root"; + }; + }; }; - }; - systemd.timers.wanikani-stats-restart = { - description = "Timer to restart WaniKani Stats Service every 12 hours"; - wantedBy = [ "timers.target" ]; - timerConfig = { - OnCalendar = "*-*-* 00,12:00:00"; - Persistent = true; - RandomizedDelaySec = "5m"; + timers.wanikani-stats-restart = { + description = "Timer to restart WaniKani Stats Service every 12 hours"; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "*-*-* 00,12:00:00"; + Persistent = true; + RandomizedDelaySec = "5m"; + }; }; }; };