Skip to content

Commit

Permalink
Merge pull request #321931 from Ma27/occ-improvements
Browse files Browse the repository at this point in the history
nixos/nextcloud: occ improvements
  • Loading branch information
Ma27 authored Jun 23, 2024
2 parents 2cfac74 + 50d5306 commit 2ac989c
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions nixos/modules/services/web-apps/nextcloud.nix
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ let
mkKeyValue = generators.mkKeyValueDefault {} " = ";
};

phpCli = concatStringsSep " " ([
"${getExe phpPackage}"
] ++ optionals (cfg.cli.memoryLimit != null) [
"-dmemory_limit=${cfg.cli.memoryLimit}"
]);

occ = pkgs.writeScriptBin "nextcloud-occ" ''
#! ${pkgs.runtimeShell}
cd ${webroot}
Expand All @@ -89,7 +95,7 @@ let
fi
export NEXTCLOUD_CONFIG_DIR="${datadir}/config"
$sudo \
${phpPackage}/bin/php \
${phpCli} \
occ "$@"
'';

Expand Down Expand Up @@ -196,6 +202,9 @@ let
in {

imports = [
(mkRenamedOptionModule
[ "services" "nextcloud" "cron" "memoryLimit" ]
[ "services" "nextcloud" "cli" "memoryLimit" ])
(mkRemovedOptionModule [ "services" "nextcloud" "enableBrokenCiphersForSSE" ] ''
This option has no effect since there's no supported Nextcloud version packaged here
using OpenSSL for RC4 SSE.
Expand Down Expand Up @@ -648,7 +657,6 @@ in {
type = types.package;
default = occ;
defaultText = literalMD "generated script";
internal = true;
description = ''
The nextcloud-occ program preconfigured to target this Nextcloud instance.
'';
Expand Down Expand Up @@ -800,7 +808,7 @@ in {
};
};

cron.memoryLimit = mkOption {
cli.memoryLimit = mkOption {
type = types.nullOr types.str;
default = null;
example = "1G";
Expand Down Expand Up @@ -1023,14 +1031,8 @@ in {
serviceConfig = {
Type = "exec";
User = "nextcloud";
ExecCondition = "${lib.getExe phpPackage} -f ${webroot}/occ status -e";
ExecStart = lib.concatStringsSep " " ([
(lib.getExe phpPackage)
] ++ optional (cfg.cron.memoryLimit != null) "-dmemory_limit=${cfg.cron.memoryLimit}"
++ [
"-f"
"${webroot}/cron.php"
]);
ExecCondition = "${phpCli} -f ${webroot}/occ status -e";
ExecStart = "${phpCli} -f ${webroot}/cron.php";
KillMode = "process";
};
};
Expand All @@ -1054,7 +1056,7 @@ in {
serviceConfig = {
Type = "exec";
User = "nextcloud";
ExecCondition = "${lib.getExe phpPackage} -f ${webroot}/occ status -e";
ExecCondition = "${phpCli} -f ${webroot}/occ status -e";
};
};
};
Expand Down

0 comments on commit 2ac989c

Please sign in to comment.