summary refs log tree commit diff
path: root/nixos/modules/services/misc/geoipupdate.nix
diff options
context:
space:
mode:
authortalyz <kim.lindberger@gmail.com>2021-06-07 13:08:59 +0200
committertalyz <kim.lindberger@gmail.com>2021-06-07 13:08:59 +0200
commit41c82cd57033ce8122899b8cf96dc824c7ce7e8d (patch)
tree171e0bf7038b94fb7741fa8c3738a29696d2ae00 /nixos/modules/services/misc/geoipupdate.nix
parentba4d2bd03c0b30c888876f8b80bb5e42747d09de (diff)
downloadnixpkgs-41c82cd57033ce8122899b8cf96dc824c7ce7e8d.tar
nixpkgs-41c82cd57033ce8122899b8cf96dc824c7ce7e8d.tar.gz
nixpkgs-41c82cd57033ce8122899b8cf96dc824c7ce7e8d.tar.bz2
nixpkgs-41c82cd57033ce8122899b8cf96dc824c7ce7e8d.tar.lz
nixpkgs-41c82cd57033ce8122899b8cf96dc824c7ce7e8d.tar.xz
nixpkgs-41c82cd57033ce8122899b8cf96dc824c7ce7e8d.tar.zst
nixpkgs-41c82cd57033ce8122899b8cf96dc824c7ce7e8d.zip
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.
Diffstat (limited to 'nixos/modules/services/misc/geoipupdate.nix')
-rw-r--r--nixos/modules/services/misc/geoipupdate.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/nixos/modules/services/misc/geoipupdate.nix b/nixos/modules/services/misc/geoipupdate.nix
index 3cf8e5e1099..15d6051fce5 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 ];