]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/tools/cloud/default.nix
Use attrs for secrets instead of lists
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / cloud / default.nix
index 50ed528a53dc1b8a35d324f729050a978d86e48f..fc0aae62f88d7b4597dbaa605ec16bc18914b5e4 100644 (file)
@@ -43,7 +43,6 @@ 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 = {
@@ -74,8 +73,7 @@ in {
       ];
     };
 
-    secrets.keys = [{
-      dest = "webapps/tools-nextcloud";
+    secrets.keys."webapps/tools-nextcloud" = {
       user = "wwwrun";
       group = "wwwrun";
       permissions = "0600";
@@ -85,7 +83,7 @@ in {
         include('${nextcloud}/version.php');
         $CONFIG = array (
           // FIXME: change this value when nextcloud starts getting slow
-          'instanceid' => '${env.instance_id}1',
+          'instanceid' => '${env.instance_id}',
           'datadirectory' => '/var/lib/nextcloud/',
           'passwordsalt' => '${env.password_salt}',
           'debug' => false,
@@ -134,14 +132,14 @@ in {
           'has_rebuilt_cache' => true,
         );
       '';
-    }];
+    };
     users.users.root.packages = let
       occ = pkgs.writeScriptBin "nextcloud-occ" ''
         #! ${pkgs.stdenv.shell}
         cd ${nextcloud}
         NEXTCLOUD_CONFIG_DIR="${nextcloud}/config" \
           exec \
-          sudo -u wwwrun ${pkgs.php74}/bin/php \
+          sudo -E -u wwwrun ${pkgs.php74}/bin/php \
           -c ${pkgs.php74}/etc/php.ini \
           occ $*
         '';
@@ -158,7 +156,7 @@ in {
         ${builtins.concatStringsSep "\n" (lib.attrsets.mapAttrsToList (n: v:
           "install -D -m 0644 -o wwwrun -g wwwrun -T ${v} ${varDir}/config/${n}.json"
           ) confs)}
-        #install -D -m 0600 -o wwwrun -g wwwrun -T /var/secrets/webapps/tools-nextcloud ${varDir}/config/config.php
+        #install -D -m 0600 -o wwwrun -g wwwrun -T ${config.secrets.fullPaths."webapps/tools-nextcloud"} ${varDir}/config/config.php
       '';
     };
     # FIXME: add a warning when config.php changes
@@ -181,7 +179,7 @@ in {
           #! ${pkgs.stdenv.shell}
           export LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive
           export PATH=/run/wrappers/bin:$PATH
-          ${pkgs.php74}/bin/php -d memory_limit=512M -f ${nextcloud}/cron.php
+          ${pkgs.php74}/bin/php -d memory_limit=2048M -f ${nextcloud}/cron.php
           '';
       in [
         ''