1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-24 10:10:37 +03:00
Commit graph

296 commits

Author SHA1 Message Date
provokateurin
530c6f09c9
nixos/nextcloud: Disable web updater by default
Disables the "Open updater" button in the admin overview and makes sure it is not possible to update the instance through the web interface.
Nextcloud runs from the source code in the nix store and should not try to update itself manually.
The only way to update Nextcloud is to update nixpkgs and therefore the web updater must be disabled.
2025-04-23 17:08:25 +02:00
Maximilian Bosch
2cb444f4fc
Merge: nixos/nextcloud: S3: Rename autocreate (a no-op) to verify_bucket_exists (#399629) 2025-04-22 16:03:51 +02:00
provokateurin
1efc79ccca
nextcloud29: drop 2025-04-21 07:48:32 +02:00
Tom Hubrecht
08e859c8e0
nixos/nextcloud: S3: Rename autocreate (a no-op) to verify_bucket_exists
C.f. https://github.com/nextcloud/documentation/issues/10436

Co-authored-by: Tom Herbers <mail@tomherbers.de>
Co-authored-by: Kate <26026535+provokateurin@users.noreply.github.com>
2025-04-18 11:14:38 +02:00
Maximilian Bosch
39dcdc5c9b
nixos/nextcloud: check if ownership of config is correct
Follow-up on #169733

For `data`, Nextcloud checks on its own if everything is readable.
However, for `config` it's crucial that the ownership is actually
correct: otherwise, systemd-tmpfiles will refuse any operations inside
because of unsafe path transitions.

This can result in a subtly broken setup by the `override.config.php`
not being updated, but also not part of the system closure anymore
(another override.config.php is referenced now) which means it'll be
GCed eventually even though Nextcloud relies on it.

If this precondition is not met, the following error will be printed:

    nextcloud-setup-start[972]: /var/lib/nextcloud/config is not owned by user 'nextcloud'!
    nextcloud-setup-start[972]: Please check the logs via 'journalctl -u systemd-tmpfiles-setup'
    nextcloud-setup-start[972]: and make sure there are no unsafe path transitions.
    nextcloud-setup-start[972]: (https://nixos.org/manual/nixos/stable/#module-services-nextcloud-pitfalls-during-upgrade)
2025-04-02 09:30:17 +02:00
Silvan Mosberger
374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00
Maximilian Bosch
f20b220e17
Merge: nixos/nextcloud: add maintainer team, update docs about maintainership of apps (#393069) 2025-04-01 11:25:28 +02:00
Maximilian Bosch
65121c9333
Merge: nextcloud-occ: work with sudo disabled (#380211) 2025-03-29 23:25:45 +01:00
Maximilian Bosch
d3110c9532
nextcloud: update maintainer information
* Create a dedicated team. Before, information was inconsistent between
  e.g. tests and package, module had none at all.
* Add maintainership from us to all trivially packaged apps. This is
  only to make sure that we take care of them building and installing
  and that's about it.
2025-03-25 12:41:18 +00:00
hot burger
2dad835033 nextcloud-occ: work with sudo disabled 2025-03-22 15:11:17 -07:00
provokateurin
34da0bd4fc
nixos/nextcloud: Also install when config.php exists but is empty
Running any occ command will create an empty config file automatically: f85154f1e1/lib/base.php (L194-L196)
This causes the current check to never execute the installation, in case any occ command was run before it (which itself fails because Nextcloud is not installled yet).
So any services which don't properly depend on nextcloud-setup.service cause Nextcloud to never be installed.
2025-03-21 14:51:30 +01:00
Aleksana
7791660b3f
nixos/nextcloud: update nextcloud version in example (#387933) 2025-03-08 20:26:35 +08:00
Maximilian Bosch
6fe52c5dae
Merge: nixos/nextcloud: fix shellcheck after #367433 (#387913) 2025-03-08 11:32:05 +01:00
shelvacu
1a4575f9db
nixos/modules: Add security.pki.caBundle option and make all services use it for CA bundles (#352244)
Previously some modules used `config.environment.etc."ssl/certs/ca-certificates.crt".source`, some used `"/etc/ssl/certs/ca-certificates.crt"`, and some used `"${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"`. These were all bad in one way or another:

- `config.environment.etc."ssl/certs/ca-certificates.crt".source` relies on `source` being set; if `text` is set instead this breaks, introducing a weird undocumented requirement
- `"/etc/ssl/certs/ca-certificates.crt"` is probably okay but very un-nix. It's a magic string, and the path doesn't change when the file changes (and so you can't trigger service reloads, for example, when the contents change in a new system activation)
- `"${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"` silently doesn't include the options from `security.pki`

Co-authored-by: Shelvacu <git@shelvacu.com>
2025-03-08 08:41:08 +00:00
Sandro
ea79d17e5b
nixos/nextcloud: update nextcloud version in example 2025-03-07 20:20:39 +01:00
Sandro Jäckel
98b175f44a
nixos/nextcloud: fix shellcheck after #367433 2025-03-07 14:41:02 +01:00
Maximilian Bosch
6c4f93e113
Merge: nixos/nextcloud: use LoadCredential to read secrets (#367433) 2025-03-07 10:58:29 +01:00
Maximilian Bosch
be4fd8fdf2
nixos/nextcloud: update docs
* Update related packages for pkg option.
* Add release notes.
2025-03-01 11:58:54 +01:00
transcaffeine
dfe1187fea
nextcloud31: init at 31.0.0
Release notes: https://github.com/nextcloud/server/releases/tag/v31.0.0
Upgrade notes: https://docs.nextcloud.com/server/31/admin_manual/release_notes/upgrade_to_31.html
2025-02-26 08:29:34 +01:00
Maximilian Bosch
f6634090cf
Merge: nixos/nextcloud: add hint about HSTS to https setting (#345609) 2025-02-22 21:16:18 +01:00
Felix Stupp
5edaed025b
nixos/nextcloud: add hint about HSTS to https setting
Enabling HSTS "just by default" when a module user requests HTTPS support to be enabled is prone to creating kind of DoS scenarios. This commit at least informs module users about this.
2025-02-22 13:01:10 +00:00
dish
82d4e0086f nixos/nextcloud: fix documentation link formatting 2025-02-12 21:03:21 +01:00
Felix Buehler
8688bb5ab0 nixos/nextcloud: expose finalPackage 2025-02-05 22:33:03 +01:00
networkException
2ce1e84103
nixos/nextcloud: use LoadCredential to read secrets
This patch adds support for using systemd's LoadCredential
feature to read various secret files used by nextcloud service
units.

Previously credentials had to be readable by the nextcloud user,
this is now no longer required.

The nextcloud-occ wrapper script has been adjusted to use
systemd-run for loading credentials when being called from
outside a service.

In detail this change touches various details of the module:

- The nix_read_secret() php function now takes the name of a
  file relative to the path specified in the CREDENTIALS_DIRECTORY
  environment variable.
- The nix_read_secret() now exits with error code 1 instead of
  throwing a RuntimeException as this will properly error out
  the nextcloud-occ script
- Only the nextcloud-setup service unit has the adminpass credential
  added in addition to the other credentials
- Uses of ExecCondition= in nextcloud-cron and nextcloud-update-db
  have been replaced by a shell conditional as ExecCondition currently
  doesn't support credentials
- The phpfpm-nextcloud service now runs a preStart script to make
  the credentials it gets readable by the nextcloud user as the
  unit runs as root but the php process itself as nextcloud.
- To invoke occ notify_push:setup when using nextcloud notify_push
  a new service has been added that replaces the preStart script
  in nextcloud-notify_push.service. This has been done as the
  main executable only needs the database password credential.

Co-authored-by: lassulus <lassulus@lassul.us>
2025-01-21 13:13:34 +01:00
networkException
e6b078981b
nixos/nextcloud: move systemd service overrides for phpfpm-nextcloud closer to phpfpm config 2025-01-21 13:13:33 +01:00
networkException
598ba3922c
nixos/nextcloud: use writeShellApplication for nextcloud-occ
This patch replaces the use of writeScriptBin for the nextcloud-occ
script with writeShellApplication, enabling shell checking.

This patch also updates various invocations of the script to
use lib.getExe.
2025-01-21 13:13:32 +01:00
Maximilian Bosch
7ef73d05cd
nextcloud28: remove
This major release is dead now.
2025-01-19 00:08:35 +01:00
piegames
dd7d5339f7 treewide: Fix incorrect string indentations 2025-01-07 19:49:28 +01:00
Maximilian Bosch
6978b4b5bd
nixos/nextcloud: increase pool settings
Also link to upstream docs about PHP-FPM tuning[1].
These seem a little more reasonable performance-wise, but are still
conservative enough for small setups.

[1] https://docs.nextcloud.com/server/30/admin_manual/installation/server_tuning.html#tune-php-fpm
2024-12-31 00:05:52 +01:00
Maximilian Bosch
c7ccfc5f9f
nixos/nextcloud: drop default for dbtype setting
Closes #355606

To quote the system requirements[1]:

> Database: SQLite 3.16+ (only recommended for testing and minimal-instances)

As discussed[2], this would already fail at eval-time for everyone and
makes all sqlite users aware that this is probably not the best choice.
Doing that regardless, is now an explicit decision.

[1] https://docs.nextcloud.com/server/30/admin_manual/installation/system_requirements.html
[2] https://github.com/NixOS/nixpkgs/pull/369242#discussion_r1899706512
2024-12-31 00:01:02 +01:00
nicoo
f6c5531461
nixos: Don't set !allowSubstitutes (#314664)
It is set by `runCommandLocal` and prevents fetching the build output
from `cache.nixos.org` or another trusted substituter.
2024-12-12 18:26:24 +00:00
Sandro Jäckel
1ada7c1d36
nixos/nextcloud: fix shellcheck findings with enableStrictShellChecks enabled 2024-10-14 18:20:25 +02:00
Peder Bergebakken Sundt
3100acba08 treewide: \xc2\xa0 ->
I have no idea what this escape sequence even is, but it breaks the nix parser with cryptic errors if not used in a comment.
A friend let me know MacOS is prone to input weird spaces, not sure if that is the source.

Candidates were located and created with:

    chr="$(echo -e '\xc2\xa0')"; rg -F "$chr" -l | xe sd -F "$chr" " "

There are some examples left, most being example output from `tree` in various markdown documents, some patches which we can't really touch, and `pkgs/tools/nix/nixos-render-docs/src/tests/test_commonmark.py` which I'm not sure if should be addressed
2024-10-02 15:33:06 +02:00
Maximilian Bosch
55a45406a6
nixos/nextcloud: update relatedPackages 2024-10-01 13:36:16 +02:00
Maximilian Bosch
20ed9ccd88
nextcloud: correct stateversion logic 2024-10-01 12:48:47 +02:00
Jonas Heinrich
1b121c1ea2
nextcloud30: init at 30.0.0 2024-10-01 12:48:45 +02:00
Mynacol
af072cfb55 nixos/nextcloud: Remove --preserve-env in sudo
This helps supporting sudo-rs, which currently does not implement the
--preserve-env flag and probably won't so in the foreseeable future [1].

The replacement just sets both environment variables behind the sudo
invocation with env, as sudo-rs also doesn't implement env var lists.

The OC_PASS variable is dropped, as it is seemingly unused and would
leak through this approach through /proc.

[1] https://github.com/memorysafety/sudo-rs/issues/129
2024-07-02 11:29:35 +02:00
Jonas Heinrich
77e7768849
Merge pull request #322397 from Ma27/bump-nextcloud
nextcloud: drop 27, 28.0.6 -> 28.0.7, 29.0.2 -> 29.0.3
2024-06-27 14:09:29 +02:00
Sandro
33f83c6252
Merge pull request #316977 from eclairevoyant/fix-mkEnableOption
treewide: fix mkEnableOption usage
2024-06-25 22:42:16 +02:00
Maximilian Bosch
60657a4591
nextcloud27: remove
Version will be EOL by the end of 2024-06.
2024-06-25 14:08:15 +02:00
Maximilian Bosch
2ac989c06f
Merge pull request #321931 from Ma27/occ-improvements
nixos/nextcloud: occ improvements
2024-06-23 17:42:42 +00:00
Maximilian Bosch
50d5306e7c
nixos/nextcloud: use dedicated memory limit for the entire CLI
Originally, I wanted to execute `nextcloud-occ` with a higher memory
limit because I needed to trigger an expensive operation by hand,
regenerating a bunch of previews.

While doing so, I realized how painful it is to put an invocation of
nextcloud-occ together for that, especially when you need to put it
into another systemd unit in Nix code.

That's why I decided to use the memory limit now for every
CLI invocation just in case. The stuff you do in those units (e.g.
running background jobs) is something you can also do by hand with
`nextcloud-occ` and you'll most likely want to have the same memory
limit there.
2024-06-22 18:39:08 +02:00
Maximilian Bosch
ab9b8f8cf4
nixos/nextcloud: services.nextcloud.occ is not internal
This option is actually useful when having a systemd unit invoking
`nextcloud-occ`, then you want to do something like

    path = [ config.services.nextcloud.occ ]

This is possible today, but not documented (and the option completion
from nil doesn't pick it up as a result).
2024-06-22 18:38:04 +02:00
Maximilian Bosch
45d2b8b536
nixos/nextcloud: deprecated dbtableprefix
Closes #320381

Installation with a custom dbtableprefix is not allowed anymore for a
while[1] and we shouldn't advertise it as such.

The option is deprecated for now since I'm not sure if there are some
weird corner-cases where removing the option directly would break
existing installations from before <20 with a custom dbtableprefix. The
migration-path for such a case is as follows:

* Check if /var/lib/nextcloud/config/config.php has the correct
  dbtableprefix set and if not, take care of it.
* Remove `dbtableprefix` from the NixOS configuration. It's effectively
  state anyways.

After a bit of time to switch (perhaps after the next release
branchoff), the option can be removed.

[1] https://github.com/nextcloud/server/issues/24836
2024-06-19 11:43:33 +02:00
éclairevoyant
7d8742da87
treewide: fix mkEnableOption usage 2024-06-14 02:41:42 -04:00
Maximilian Bosch
dddd08d188
nixos/nextcloud: make memory_limit of nextcloud-cron configurable
The memory limit is equal to what's configured in php-fpm. Given that we
run in a different environment, it seems reasonable to allow different
memory contraints here.
2024-05-30 23:38:55 +02:00
Robert Schütz
dce84c46d7 nixos/nextcloud: correct latest version 2024-05-16 08:53:01 -07:00
Jonas Heinrich
4a451cb3ce
Merge pull request #308291 from Ma27/nc-update-db
nixos/nextcloud: add nextcloud-update-db.service, nextcloud-cron isn't oneshot
2024-05-08 11:29:45 +02:00
Maximilian Bosch
c7a1616be7
nixos/nextcloud: add trailing slashes to carddav/caldav redirect
This seems to solve the problem with the warning about carddav/caldav
redirects being broken.
2024-05-05 18:17:25 +02:00
Maximilian Bosch
5ef467d6f5
nixos/nextcloud: add nextcloud-update-db.service, nextcloud-cron isn't oneshot
This service performs operations that significantly increase the
performance of Nextcloud, can take a while. These are designed however
to not require maintenance mode and can be executed during normal
operation[1].

Make nextcloud-cron a simple unit instead of oneshot: otherwise we risk
that it'll be stopped by the startup timeout (oneshot executes ExecStart
while "activating") which can be an issue for very long running tasks or
if Nextcloud needs to catch up if one task was broken for a while.

[1] https://docs.nextcloud.com/server/29/admin_manual/maintenance/upgrade.html#long-running-migration-steps
2024-05-01 20:09:37 +02:00