Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nextcloud: Add phpExtraExtensions #109035

Merged
merged 4 commits into from Jan 30, 2021
Merged

Conversation

turion
Copy link
Contributor

@turion turion commented Jan 11, 2021

Motivation for this change

Fixes #107875

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

I tested on my local Nextcloud installation with phpExtraExtensions = all: (with all; [ pdlib bz2 ] );. I could then run the https://apps.nextcloud.com/apps/facerecognition app which needs these extra extensions.

Supersedes #108872.

CC @aanderse @talyz @lheckemann @etu @Ma27 @SuperSandro2000

@turion turion changed the title Dev nextcloud php Nextcloud: Add phpExtraExtensions Jan 11, 2021
@turion turion requested review from talyz, Ma27 and lheckemann and removed request for talyz and Ma27 January 11, 2021 17:25
phpPackage = pkgs.php74.buildEnv {
extensions = { enabled, all }:
enabled
++ (with all; [ apcu redis memcached imagick ]) # Necessary for vanilla nextcloud
Copy link
Member

@aanderse aanderse Jan 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are apcu, redis, and memcached needed if caching.apcu, caching.redis, and caching.memcached are set to false?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Good question. Maybe not. With the new change, we could definitely make these extensions dependent on the options, and it's a good idea if it works.

It seems that the memcached option is actually never used for anything. Is that right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My impression is that in this commit, the extension setting was changed from optionally adding the three caching extensions to always adding them: ed20aae#diff-80ddb2d38f0f6e01125ccb8683381d7be20be1df3dce01e5c200dd74f5173623

So probably the right way forward now is to make them optional again, since this is easy now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. See nixos/tests/nextcloud/with-mysql-and-memcached.nix.

Are apcu, redis, and memcached needed if caching.apcu, caching.redis, and caching.memcached are set to false?

I don't know. And I'd be especially cautious with apcu as this is something that's something where people often assume that it's "just available".

Is it really worth making this module even more complex to save the closure footprint of a single php extension though?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case I would recommend removing those options if they do nothing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. See nixos/tests/nextcloud/with-mysql-and-memcached.nix.

What do you mean? That test manually sets up memcached.

Is it really worth making this module even more complex to save the closure footprint of a single php extension though?

I don't know. Does the PHP extension for redis pull in redis-the-service/package as an additional dependency? Then it would be worth making it configurable. If it's just a few small PHP files, then I agree with @aanderse that the options should be removed, and the documentation adjusted that these extensions can always be assumed to be available.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ma27 how shall we go forward?

@@ -511,7 +533,6 @@ in {
pools.nextcloud = {
user = "nextcloud";
group = "nextcloud";
phpOptions = phpOptionsStr;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you confirmed whether this is actually fine?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took this commit from @aanderse . I don't know whether it is correct. It worked on my server, but I didn't tweak this setting.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ma27 as you can see it is applied twice. I looked and confirmed duplicate config was generated.

extensions = { enabled, all }:
enabled
++ (with all;
[ imagick ] # Always enabled
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't even evaluate since there's a missing ++.

It may be better to put ++ before a line, then it's also easier to comment a single line out during debugging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better?

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 <link linkend="opt-services.nextcloud.phpExtraExtensions">nextcloud.phpExtraExtensions</link> setting.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<xref linkend="opt-..." />.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's confusing. The rest of the document uses the format I took. I don't know what the difference is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text of the link is generated automatically by <xref />, while it needs to be specified with <link>…</link>. This is used throughout the manuals.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

nixos/modules/services/web-apps/nextcloud.nix Outdated Show resolved Hide resolved
@turion
Copy link
Contributor Author

turion commented Jan 27, 2021

Rebased onto #110707

@infinisil infinisil merged commit 45a7914 into NixOS:master Jan 30, 2021
@turion turion deleted the dev_nextcloud_php branch July 1, 2021 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make nextcloud php package customizable
5 participants