From 0e5920346973ed7ecb0bdd479aeafa0aca593d9c Mon Sep 17 00:00:00 2001 From: Florian Agbuya Date: Tue, 3 Sep 2024 14:03:11 +0800 Subject: [PATCH 1/2] flarum: fix flarum directory permissions (cherry picked from commit 249dacfaa8e422e60247cc5fa35e292f7f39bbda) --- nixos/modules/services/web-apps/flarum.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nixos/modules/services/web-apps/flarum.nix b/nixos/modules/services/web-apps/flarum.nix index a967c3b121bd..d13037aa8472 100644 --- a/nixos/modules/services/web-apps/flarum.nix +++ b/nixos/modules/services/web-apps/flarum.nix @@ -116,6 +116,7 @@ in { isSystemUser = true; home = cfg.stateDir; createHome = true; + homeMode = "755"; group = cfg.group; }; users.groups.${cfg.group} = {}; @@ -194,8 +195,6 @@ in { cp -f ${cfg.package}/share/php/flarum/{extend.php,site.php,flarum} . ln -sf ${cfg.package}/share/php/flarum/vendor . ln -sf ${cfg.package}/share/php/flarum/public/index.php public/ - chmod a+x . public - chmod +x site.php extend.php flarum '' + optionalString (cfg.createDatabaseLocally && cfg.database.driver == "mysql") '' if [ ! -f config.php ]; then php flarum install --file=${flarumInstallConfig} From c2a2bf70c1f4ee43d6f4da91878206a263797298 Mon Sep 17 00:00:00 2001 From: Florian Agbuya Date: Tue, 3 Sep 2024 16:18:45 +0800 Subject: [PATCH 2/2] flarum: disable automatic DB creation (cherry picked from commit 1032b5fa9585bb72626d43e31694f65324422dd5) --- nixos/modules/services/web-apps/flarum.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/web-apps/flarum.nix b/nixos/modules/services/web-apps/flarum.nix index d13037aa8472..95ebcc23e7e8 100644 --- a/nixos/modules/services/web-apps/flarum.nix +++ b/nixos/modules/services/web-apps/flarum.nix @@ -106,8 +106,14 @@ in { createDatabaseLocally = mkOption { type = types.bool; - default = true; - description = "Create the database and database user locally, and run installation."; + default = false; + description = '' + Create the database and database user locally, and run installation. + + WARNING: Due to https://github.com/flarum/framework/issues/4018, this option is set + to false by default. The 'flarum install' command may delete existing database tables. + Only set this to true if you are certain you are working with a fresh, empty database. + ''; }; };