Merge pull request #109035 from turion/dev_nextcloud_php

Nextcloud: Add phpExtraExtensions
master
Silvan Mosberger 2021-01-30 02:41:13 +01:00 committed by GitHub
commit 45a7914186
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 13 deletions

View File

@ -6,17 +6,19 @@ let
cfg = config.services.nextcloud;
fpm = config.services.phpfpm.pools.nextcloud;
phpPackage =
let
base = pkgs.php74;
in
base.buildEnv {
extensions = { enabled, all }: with all;
enabled ++ [
apcu redis memcached imagick
];
extraConfig = phpOptionsStr;
};
phpPackage = pkgs.php74.buildEnv {
extensions = { enabled, all }:
(with all;
enabled
++ [ imagick ] # Always enabled
# Optionally enabled depending on caching settings
++ optional cfg.caching.apcu apcu
++ optional cfg.caching.redis redis
++ optional cfg.caching.memcached memcached
)
++ cfg.phpExtraExtensions all; # Enabled by user
extraConfig = toKeyValue phpOptions;
};
toKeyValue = generators.toKeyValue {
mkKeyValue = generators.mkKeyValueDefault {} " = ";
@ -27,7 +29,6 @@ let
post_max_size = cfg.maxUploadSize;
memory_limit = cfg.maxUploadSize;
} // cfg.phpOptions;
phpOptionsStr = toKeyValue phpOptions;
occ = pkgs.writeScriptBin "nextcloud-occ" ''
#! ${pkgs.runtimeShell}
@ -116,6 +117,21 @@ in {
'';
};
phpExtraExtensions = mkOption {
type = with types; functionTo (listOf package);
default = all: [];
defaultText = "all: []";
description = ''
Additional PHP extensions to use for nextcloud.
By default, only extensions necessary for a vanilla nextcloud installation are enabled,
but you may choose from the list of available extensions and add further ones.
This is sometimes necessary to be able to install a certain nextcloud app that has additional requirements.
'';
example = literalExample ''
all: [ all.pdlib all.bz2 ]
'';
};
phpOptions = mkOption {
type = types.attrsOf types.str;
default = {
@ -511,7 +527,6 @@ in {
pools.nextcloud = {
user = "nextcloud";
group = "nextcloud";
phpOptions = phpOptionsStr;
phpPackage = phpPackage;
phpEnv = {
NEXTCLOUD_CONFIG_DIR = "${cfg.home}/config";

View File

@ -182,6 +182,17 @@
</para>
</section>
<section xml:id="installing-apps-php-extensions-nextcloud">
<title>Installing Apps and PHP extensions</title>
<para>
Nextcloud apps are installed statefully through the web interface.
Some apps may require extra PHP extensions to be installed.
This can be configured with the <xref linkend="opt-services.nextcloud.phpExtraExtensions" /> setting.
</para>
</section>
<section xml:id="module-services-nextcloud-maintainer-info">
<title>Maintainer information</title>

View File

@ -42,6 +42,7 @@ in {
enable = true;
startAt = "20:00";
};
phpExtraExtensions = all: [ all.bz2 ];
};
environment.systemPackages = [ cfg.services.nextcloud.occ ];