From f015b0cc5a16d38a8f79d6f65262c1a0da90af86 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Fri, 4 Jul 2025 23:35:51 +0900 Subject: [PATCH] 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 78a20758e004fd9d7394250efe406f1a86d13c11) --- nixos/modules/services/web-apps/nextcloud.nix | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/nixos/modules/services/web-apps/nextcloud.nix b/nixos/modules/services/web-apps/nextcloud.nix index af698b0d8358..505501ba1fa8 100644 --- a/nixos/modules/services/web-apps/nextcloud.nix +++ b/nixos/modules/services/web-apps/nextcloud.nix @@ -584,11 +584,14 @@ in config = { dbtype = mkOption { - type = types.enum [ - "sqlite" - "pgsql" - "mysql" - ]; + type = types.nullOr ( + types.enum [ + "sqlite" + "pgsql" + "mysql" + ] + ); + default = null; description = "Database type."; }; dbname = mkOption { @@ -1093,6 +1096,17 @@ in instead of password. ''; } + { + assertion = cfg.config.dbtype != null; + message = '' + `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 + ''; + } ]; }