]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/tools/cloud/default.nix
Add specification for the private config file as a module.
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / cloud / default.nix
index fffe04ca4076101fc484b0fa797cbe734936113d..4785074bc49042abdef5a9c930d713dcc550b65a 100644 (file)
@@ -1,7 +1,7 @@
-{ lib, pkgs, config, myconfig,  ... }:
+{ lib, pkgs, config,  ... }:
 let
   nextcloud = pkgs.webapps.nextcloud.withApps (builtins.attrValues pkgs.webapps.nextcloud-apps);
-  env = myconfig.env.tools.nextcloud;
+  env = config.myEnv.tools.nextcloud;
   varDir = "/var/lib/nextcloud";
   webappName = "tools_nextcloud";
   apacheRoot = "/run/current-system/webapps/${webappName}";
@@ -48,6 +48,7 @@ in {
   };
 
   config = lib.mkIf cfg.enable {
+    # FIXME: find a way to backup the data
     services.websites.env.tools.modules = [ "proxy_fcgi" ];
 
     services.websites.env.tools.vhostConfs.cloud = {
@@ -128,7 +129,7 @@ in {
           array (
             'host' => '${env.redis.socket}',
             'port' => 0,
-            'dbindex' => ${env.redis.db_index},
+            'dbindex' => ${env.redis.db},
           ),
           'overwrite.cli.url' => 'https://cloud.immae.eu',
           'ldapIgnoreNamingRules' => false,
@@ -177,10 +178,16 @@ in {
 
     services.cron = {
       enable = true;
-      systemCronJobs = [
+      systemCronJobs = let
+        script = pkgs.writeScriptBin "nextcloud-cron" ''
+          #! ${pkgs.stdenv.shell}
+          export LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive
+          export PATH=/run/wrappers/bin:$PATH
+          ${pkgs.php}/bin/php -d memory_limit=512M -f ${nextcloud}/cron.php
+          '';
+      in [
         ''
-          LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive
-          */15 * * * * wwwrun ${pkgs.php}/bin/php -f ${nextcloud}/cron.php
+          */15 * * * * wwwrun ${script}/bin/nextcloud-cron
         ''
       ];
     };