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

nixos/nextcloud: add phpPackage option #108872

Closed
wants to merge 2 commits into from

Conversation

aanderse
Copy link
Member

@aanderse aanderse commented Jan 9, 2021

Motivation for this change

#107875

I don't use this module, so if @turion could provide testing it would be much appreciated.

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.

@aanderse
Copy link
Member Author

aanderse commented Jan 9, 2021

@GrahamcOfBorg test nextcloud

@SuperSandro2000
Copy link
Member

I don't think we need an option to overwrite the php version. A list with extensions to enable would be much easier to use and less likely to break things. I am pretty sure Nextcloud does not support php80 yet or any much older version.

@turion
Copy link
Contributor

turion commented Jan 9, 2021

Both options seem fine to me.

@aanderse
Copy link
Member Author

aanderse commented Jan 9, 2021

This flexibility seems worthwhile to me. This option allows users to create a minimal php package as well as an added bonus.

@turion
Copy link
Contributor

turion commented Jan 9, 2021

I tested this successfully on my server. I enabled the bz2 and pdlib extensions with which I could install and enable https://apps.nextcloud.com/apps/facerecognition. Thanks!

@aanderse aanderse requested review from talyz and etu January 9, 2021 19:41
@aanderse
Copy link
Member Author

aanderse commented Jan 9, 2021

Pulling in @etu and @talyz for opinions and review ❤️

@SuperSandro2000
Copy link
Member

This flexibility seems worthwhile to me.

and makes it harder to understand and way easier to do something breaking.

Please compare the size of those two expressions:

pkgs.php74.withExtensions ({ enabled, all }: enabled ++ [ all.pdlib all.bz2 ])
[ bz2 pdlib ]

Also the first is pinning php to 74 which is not ideal.

This option allows users to create a minimal php package as well as an added bonus.

Nextcloud and minimal is a good joke. I don't think you can even create a more minimal php package set with the standard installation.

@turion
Copy link
Contributor

turion commented Jan 10, 2021

This flexibility seems worthwhile to me.

and makes it harder to understand and way easier to do something breaking.

Please compare the size of those two expressions:

pkgs.php74.withExtensions ({ enabled, all }: enabled ++ [ all.pdlib all.bz2 ])
[ bz2 pdlib ]

I'm afraid it won't be that easy. bz2 and pdlib are not in scope, so it will have to be a pattern like this at least:

all: [ all.bz2 all.pdlib ]

To match the existing conventions, we could also write it as:

{ enabled, all }: enabled ++ [ all.pdlib all.bz2 ]

The latter pattern also allows us to disable certain extensions, which may be what the users wants (although I didn't have such a use case myself yet).

@turion
Copy link
Contributor

turion commented Jan 10, 2021

Also the first is pinning php to 74 which is not ideal.

That's true. This is a real advantage of only selecting extensions instead of making the whole package.

@Ma27
Copy link
Member

Ma27 commented Jan 10, 2021

I agree with @SuperSandro2000 here: as maintainers we have to take care that a PHP we ship for Nextcloud works for the base module. It should be possible to use additional modules if needed and config can be written in the module itself.

@turion
Copy link
Contributor

turion commented Jan 10, 2021

Then the best option is probably a pattern like all: [ all.bz2 all.pdlib ] because this also rules out the possibility of accidentally disabling extensions needed by nextcloud

@SuperSandro2000
Copy link
Member

This would be the easiest:

pkgs.php74.withExtensions ({ enabled, all }: enabled ++ with all; [ extraPackages ])

extraPackages = [ bz2 pdlib ]

The latter pattern also allows us to disable certain extensions, which may be what the users wants

If we can't think about a usecase right now we should ignore it. If someone has a really good argument to add it we can always revisit it.

@aanderse aanderse closed this Jan 10, 2021
@aanderse aanderse deleted the nixos/nextcloud branch January 10, 2021 13:00
@talyz
Copy link
Contributor

talyz commented Jan 10, 2021

Also the first is pinning php to 74 which is not ideal.

You can drop the 74 to always use the latest version, i.e. just write

php.withExtensions ({ enabled, all }: enabled ++ [ all.pdlib all.bz2 ])

instead.

I do however agree that, if it's unnecessary to configure the version of PHP used, it would be better to only allow additional extensions to be specified.

This would be the easiest:

pkgs.php74.withExtensions ({ enabled, all }: enabled ++ with all; [ extraPackages ])

extraPackages = [ bz2 pdlib ]

That won't work, though; you'll get an undefined variable error when nix is trying to evaluate bz2 or pdlib, since they're not in scope. They have to be passed as an argument to a function; i.e. the argument to the option will have to be a lambda with one argument, the set of valid extensions.

@turion
Copy link
Contributor

turion commented Jan 11, 2021

@aanderse What do you think is the best way forward?

@aanderse
Copy link
Member Author

@turion - I think the best way forward is to add a phpPackage option but a room full of people, all smarter than myself, don't think this is the best way forward... so my opinion is wrong. I'm OK with that 😄

I don't use the nextcloud module so my participation ends here. I think it is pretty straight forward to implement any of the above suggestions. I'd just ask that when someone makes a PR they include db19515 because it removed duplicate generated configuration 👍

@turion
Copy link
Contributor

turion commented Jan 11, 2021

Ok, thanks for your work :) I'll make a new PR based on this.

@turion turion mentioned this pull request Jan 11, 2021
10 tasks
@turion
Copy link
Contributor

turion commented Jan 11, 2021

Some context: There was a commit 2 years ago, going like this:

nixos/nextcloud: don't make phpPackages configurable

It needs to match the version in phpfm which is hard coded.
So there is no point in being able to change it.

This is why the package should not be configurable.

@aanderse
Copy link
Member Author

Yes, this made perfect sense before some of our superstars (@etu and @talyz) rewrote the entire php ecosystem to handle these shortcomings. The reasoning from that comment is no longer valid. Other reasons seem to be why people don't want this to happen now 👍

@turion
Copy link
Contributor

turion commented Jan 11, 2021

Ok, makes sense, thanks!

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.

None yet

5 participants