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.
This commit is contained in:
talyz 2021-06-07 13:08:59 +02:00
parent ba4d2bd03c
commit 41c82cd570
No known key found for this signature in database
GPG key ID: 2DED2151F4671A2B

View file

@ -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 ];