]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - nixops/modules/websites/commons/stats.nix
Do stats computation sequentially
[perso/Immae/Config/Nix.git] / nixops / modules / websites / commons / stats.nix
index b5bf0e04dc6658be784c11ebddbc6b20edfdc0ed..e2c1e62f73402a52a821fb670bb513b0682f1792 100644 (file)
@@ -55,8 +55,15 @@ in {
             goaccess $TMPFILE --no-progress -o /var/lib/goaccess/${domain}/index.html -p ${conf}
             '';
           in "${d}/bin/stats-${domain}";
+        allStats = sites: pkgs.writeScript "stats" ''
+          #!${pkgs.stdenv.shell}
+
+          ${builtins.concatStringsSep "\n" (map (v: stats v.name v.conf) sites)}
+          '';
       in
-        pkgs.lib.lists.imap0 (i: v: "${toString (i+5)} 0 * * * root ${stats v.name v.conf}") cfg.sites;
+        [
+          "5 0 * * * root ${allStats cfg.sites}"
+        ];
     };
 
     system.activationScripts.goaccess = ''