···217217218218- The [services.wordpress.sites.<name>.plugins](#opt-services.wordpress.sites._name_.plugins) and [services.wordpress.sites.<name>.themes](#opt-services.wordpress.sites._name_.themes) options have been converted from sets to attribute sets to allow for consumers to specify explicit install paths via attribute name.
219219220220+- [`services.nextcloud.database.createLocally`](#opt-services.nextcloud.database.createLocally) now uses socket authentication and is no longer compatible with password authentication.
221221+ - If you want the module to manage the database for you, unset [`services.nextcloud.config.dbpassFile`](#opt-services.nextcloud.config.dbpassFile) (and [`services.nextcloud.config.dbhost`](#opt-services.nextcloud.config.dbhost), if it's set).
222222+ - If your database is external, simply set [`services.nextcloud.database.createLocally`](#opt-services.nextcloud.database.createLocally) to `false`.
223223+ - If you want to use password authentication **and** create the database locally, you will have to use [`services.mysql`](#opt-services.mysql.enable) to set it up.
224224+220225- `protonmail-bridge` package has been updated to major version 3.
221226222227- Nebula now runs as a system user and group created for each nebula network, using the `CAP_NET_ADMIN` ambient capability on launch rather than starting as root. Ensure that any files each Nebula instance needs to access are owned by the correct user and group, by default `nebula-${networkName}`.
+10-24
nixos/modules/services/web-apps/nextcloud.md
···12121313Nextcloud is a PHP-based application which requires an HTTP server
1414([`services.nextcloud`](#opt-services.nextcloud.enable)
1515-optionally supports
1616-[`services.nginx`](#opt-services.nginx.enable))
1717-and a database (it's recommended to use
1818-[`services.postgresql`](#opt-services.postgresql.enable)).
1515+and optionally supports
1616+[`services.nginx`](#opt-services.nginx.enable)).
1717+1818+For the database, you can set
1919+[`services.nextcloud.config.dbtype`](#opt-services.nextcloud.config.dbtype) to
2020+either `sqlite` (the default), `mysql`, or `pgsql`. For the last two, by
2121+default, a local database will be created and nextcloud will connect to it via
2222+socket; this can be disabled by setting
2323+[`services.nextcloud.database.createLocally`](#opt-services.nextcloud.database.createLocally)
2424+to `false`.
19252026A very basic configuration may look like this:
2127```
···2632 hostName = "nextcloud.tld";
2733 config = {
2834 dbtype = "pgsql";
2929- dbuser = "nextcloud";
3030- dbhost = "/run/postgresql"; # nextcloud will add /.s.PGSQL.5432 by itself
3131- dbname = "nextcloud";
3235 adminpassFile = "/path/to/admin-pass-file";
3333- adminuser = "root";
3436 };
3535- };
3636-3737- services.postgresql = {
3838- enable = true;
3939- ensureDatabases = [ "nextcloud" ];
4040- ensureUsers = [
4141- { name = "nextcloud";
4242- ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES";
4343- }
4444- ];
4545- };
4646-4747- # ensure that postgres is running *before* running the setup
4848- systemd.services."nextcloud-setup" = {
4949- requires = ["postgresql.service"];
5050- after = ["postgresql.service"];
5137 };
52385339 networking.firewall.allowedTCPPorts = [ 80 443 ];
+41-22
nixos/modules/services/web-apps/nextcloud.nix
···57575858 inherit (config.system) stateVersion;
59596060+ mysqlLocal = cfg.database.createLocally && cfg.config.dbtype == "mysql";
6161+ pgsqlLocal = cfg.database.createLocally && cfg.config.dbtype == "pgsql";
6262+6063in {
61646265 imports = [
···314317315318 createLocally = mkOption {
316319 type = types.bool;
317317- default = false;
320320+ default = true;
318321 description = lib.mdDoc ''
319319- Create the database and database user locally. Only available for
320320- mysql database.
321321- Note that this option will use the latest version of MariaDB which
322322- is not officially supported by Nextcloud. As for now a workaround
323323- is used to also support MariaDB version >= 10.6.
322322+ Create the database and database user locally.
324323 '';
325324 };
326325···352351 };
353352 dbhost = mkOption {
354353 type = types.nullOr types.str;
355355- default = "localhost";
354354+ default =
355355+ if pgsqlLocal then "/run/postgresql"
356356+ else if mysqlLocal then "localhost:/run/mysqld/mysqld.sock"
357357+ else "localhost";
358358+ defaultText = "localhost";
356359 description = lib.mdDoc ''
357357- Database host.
358358-359359- Note: for using Unix authentication with PostgreSQL, this should be
360360- set to `/run/postgresql`.
360360+ Database host or socket path. Defaults to the correct unix socket
361361+ instead if `services.nextcloud.database.createLocally` is true and
362362+ `services.nextcloud.config.dbtype` is either `pgsql` or `mysql`.
361363 '';
362364 };
363365 dbport = mkOption {
···737739 }
738740739741 { assertions = [
740740- { assertion = cfg.database.createLocally -> cfg.config.dbtype == "mysql";
741741- message = ''services.nextcloud.config.dbtype must be set to mysql if services.nextcloud.database.createLocally is set to true.'';
742742+ { assertion = cfg.database.createLocally -> cfg.config.dbpassFile == null;
743743+ message = ''
744744+ Using `services.nextcloud.database.createLocally` (that now defaults
745745+ to true) with database password authentication is no longer
746746+ supported.
747747+748748+ If you use an external database (or want to use password auth for any
749749+ other reason), set `services.nextcloud.database.createLocally` to
750750+ `false`. The database won't be managed for you (use `services.mysql`
751751+ if you want to set it up).
752752+753753+ If you want this module to manage your nextcloud database for you,
754754+ unset `services.nextcloud.config.dbpassFile` and
755755+ `services.nextcloud.config.dbhost` to use socket authentication
756756+ instead of password.
757757+ '';
742758 }
743759 ]; }
744760···902918 in {
903919 wantedBy = [ "multi-user.target" ];
904920 before = [ "phpfpm-nextcloud.service" ];
921921+ after = optional mysqlLocal "mysql.service" ++ optional pgsqlLocal "postgresql.service";
922922+ requires = optional mysqlLocal "mysql.service" ++ optional pgsqlLocal "postgresql.service";
905923 path = [ occ ];
906924 script = ''
907925 ${optionalString (c.dbpassFile != null) ''
···1007102510081026 environment.systemPackages = [ occ ];
1009102710101010- services.mysql = lib.mkIf cfg.database.createLocally {
10281028+ services.mysql = lib.mkIf mysqlLocal {
10111029 enable = true;
10121030 package = lib.mkDefault pkgs.mariadb;
10131031 ensureDatabases = [ cfg.config.dbname ];
···10151033 name = cfg.config.dbuser;
10161034 ensurePermissions = { "${cfg.config.dbname}.*" = "ALL PRIVILEGES"; };
10171035 }];
10181018- initialScript = pkgs.writeText "mysql-init" ''
10191019- CREATE USER '${cfg.config.dbname}'@'localhost' IDENTIFIED BY '${builtins.readFile( cfg.config.dbpassFile )}';
10201020- CREATE DATABASE IF NOT EXISTS ${cfg.config.dbname};
10211021- GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER,
10221022- CREATE TEMPORARY TABLES ON ${cfg.config.dbname}.* TO '${cfg.config.dbuser}'@'localhost'
10231023- IDENTIFIED BY '${builtins.readFile( cfg.config.dbpassFile )}';
10241024- FLUSH privileges;
10251025- '';
10361036+ };
10371037+10381038+ services.postgresql = mkIf pgsqlLocal {
10391039+ enable = true;
10401040+ ensureDatabases = [ cfg.config.dbname ];
10411041+ ensureUsers = [{
10421042+ name = cfg.config.dbuser;
10431043+ ensurePermissions = { "DATABASE ${cfg.config.dbname}" = "ALL PRIVILEGES"; };
10441044+ }];
10261045 };
1027104610281047 services.nginx.enable = mkDefault true;