Commit graph

309 commits

Author SHA1 Message Date
provokateurin fa2741c80f
nextcloud32: init at 32.0.0
Subset of the original commit, without the breaking changes (i.e.
changes of defaults).

(cherry picked from commit 34a7111f89)
2025-10-27 11:31:57 +01:00
staticdev a79798ac63 fetchNextcloudApp: add sha512
(cherry picked from commit 2196fed2b6)
2025-10-05 15:51:40 +02:00
Wolfgang Walther 5cbdb94f3a
treewide: remove redundant parentheses
Auto-fixed by nixf-diagnose.

(cherry picked from commit 91a8fee3aa)
2025-10-05 12:59:25 +02:00
Robert Schütz b7338ccd18
nixos/nextcloud: remove X-XSS-Protection
see https://github.com/nextcloud/server/pull/53476

(cherry picked from commit 06c99c29c9)
2025-09-13 14:21:44 -04:00
provokateurin 9a0dee2e9c nixos/nextcloud: Pass OC_PASS and NC_PASS environment variables to nextcloud-occ
(cherry picked from commit ba24e7fa23)
2025-09-03 22:36:44 +00:00
Wolfgang Walther aefcb0d50d
treewide: run nixfmt 1.0.0 2025-07-24 14:58:18 +02:00
Dominique Martinet f015b0cc5a nixos/nextcloud: add assertion explaining to set dbtype
Since 25.05 dbtype no longer defaults to sqlite and this yields an error
that is understandable enough but not easy to properly address.

Add an assert that is more explicit.

Before:
```
       error: The option `nodes.nextcloud.services.nextcloud.config.dbtype' was accessed but has no value defined. Try setting the option.
```

After:
```
       error:
       Failed assertions:
       - `services.nextcloud.config.dbtype` must be set explicitly (pgsql, mysql, or sqlite)

       Before 25.05, it used to default to sqlite but that is not recommended by upstream.
       Either set it to sqlite as it used to be, or convert to another type as described
       in the official db conversion page:
       https://docs.nextcloud.com/server/latest/admin_manual/configuration_database/db_conversion.html
```

Link: https://github.com/NixOS/nixpkgs/pull/369242#issuecomment-3036296243
(cherry picked from commit 78a20758e0)
2025-07-05 08:00:57 +00:00
teutat3s 51c458590c
nixos/nextcloud: sync nginx config with upstream
Upstream changes were checked by checking out the stable31 branch of the
https://github.com/nextcloud/documentation and comparing:

git diff c1c9b0a072537544769fdd6062989a631d4fb17c admin_manual/installation/nginx-root.conf.sample

Notably, this adds the text/javascript and application/wasm mime types to the list of
gzip'ed mime types, which improves nextcloud loading in our testing.

Also adds webp support.

(cherry picked from commit 0c7a8d5255)
2025-06-26 15:09:48 +02:00
Maximilian Bosch 26126c75df
Merge: Use cacert in Nextcloud (#406252) 2025-05-15 18:50:53 +02:00
provokateurin 12f8199080
nixos/nextcloud: Override cacert package with config.security.pki.caBundle 2025-05-15 18:19:52 +02:00
provokateurin dfb7f45bb8
nixos/nextcloud: Disable integrity check 2025-05-11 21:34:33 +02:00
networkException 23468ad19f
nixos/nextcloud: use LoadCredential to read services.nextcloud.secretFile
This patch adds support for using systemd's LoadCredential
feature to read in a json file at a path defined in the
services.nextcloud.secretFile option.

This is a follow up to 2ce1e84103.
2025-05-10 20:36:01 +02:00
Riyyi 39fbbb7ba0
nixos/nextcloud: fix typo in extraApps example (#404314) 2025-05-05 17:00:50 +08:00
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