Skip to content

Commit

Permalink
flarum module: define package config, use in config
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Leightcap <jack@leightcap.com>
  • Loading branch information
jleightcap committed Aug 18, 2023
1 parent ea685c1 commit b195592
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions modules/flarum.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ in
services.flarum = {
enable = mkEnableOption "Flarum discussion platform";

package = mkPackageOptions pkgs "flarum" {};

forumTitle = mkOption {
type = types.str;
default = "A Flarum Forum on NixOS";
Expand Down Expand Up @@ -155,7 +157,7 @@ in
extraConfig =
''
index index.php;
include ${pkgs.flarum}/.nginx.conf;
include ${cfg.package}/.nginx.conf;
'';
};
};
Expand Down Expand Up @@ -192,9 +194,9 @@ in
mkdir -p ${cfg.stateDir}/{extensions,public/assets/avatars}
mkdir -p ${cfg.stateDir}/storage/{formatter,sessions,views}
cd ${cfg.stateDir}
cp -f ${pkgs.flarum}/{extend.php,site.php,flarum} .
ln -sf ${pkgs.flarum}/vendor .
ln -sf ${pkgs.flarum}/public/index.php public/
cp -f ${cfg.package}/{extend.php,site.php,flarum} .
ln -sf ${cfg.package}/vendor .
ln -sf ${cfg.package}/public/index.php public/
chmod a+x . public
'' + lib.optionalString (cfg.createDatabaseLocally && cfg.database.driver == "mysql") ''
cp ${flarumInstallConfig} .
Expand Down

0 comments on commit b195592

Please sign in to comment.