From 41c82cd57033ce8122899b8cf96dc824c7ce7e8d Mon Sep 17 00:00:00 2001 From: talyz Date: Mon, 7 Jun 2021 13:08:59 +0200 Subject: [PATCH] nixos/geoipupdate: Run the service right away one time We don't want to have to wait for the timer to expire for the updater to make its first run. This adds a timer unit which triggers the geoipupdate.service unit immediately, but only runs if the configured DatabaseDirectory doesn't exist yet. --- nixos/modules/services/misc/geoipupdate.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nixos/modules/services/misc/geoipupdate.nix b/nixos/modules/services/misc/geoipupdate.nix index 3cf8e5e1099f..15d6051fce56 100644 --- a/nixos/modules/services/misc/geoipupdate.nix +++ b/nixos/modules/services/misc/geoipupdate.nix @@ -152,6 +152,15 @@ in RuntimeDirectoryMode = 0700; }; }; + + systemd.timers.geoipupdate-initial-run = { + wantedBy = [ "timers.target" ]; + unitConfig.ConditionPathExists = "!${cfg.settings.DatabaseDirectory}"; + timerConfig = { + Unit = "geoipupdate.service"; + OnActiveSec = 0; + }; + }; }; meta.maintainers = [ lib.maintainers.talyz ];