diff --git a/modules/services/databases/postgresql.nix b/modules/services/databases/postgresql.nix index 4a51d47b038d..df41fdad513a 100644 --- a/modules/services/databases/postgresql.nix +++ b/modules/services/databases/postgresql.nix @@ -1,7 +1,8 @@ -{pkgs, config, ...}: +{ config, pkgs, ... }: + +with pkgs.lib; let - inherit (pkgs.lib) mkOption mkIf singleton; cfg = config.services.postgresql; @@ -12,7 +13,7 @@ let run = "${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} postgres"; - flags = if cfg.enableTCPIP then ["-i"] else []; + flags = optional cfg.enableTCPIP "-i"; # The main PostgreSQL configuration file. configFile = pkgs.writeText "postgresql.conf" diff --git a/modules/services/web-servers/apache-httpd/mediawiki.nix b/modules/services/web-servers/apache-httpd/mediawiki.nix index f694f1701e66..13dee652bcc8 100644 --- a/modules/services/web-servers/apache-httpd/mediawiki.nix +++ b/modules/services/web-servers/apache-httpd/mediawiki.nix @@ -71,6 +71,16 @@ let cp ${mediawikiConfig} $out/LocalSettings.php ''; }; + + mediawikiScripts = pkgs.runCommand "mediawiki-${config.id}-scripts" + { buildInputs = [ pkgs.makeWrapper ]; } + '' + ensureDir $out/bin + for i in changePassword.php createAndPromote.php userOptions.php edit.php nukePage.php; do + makeWrapper ${pkgs.php}/bin/php $out/bin/mediawiki-${config.id}-$(basename $i .php) \ + --add-flags ${mediawikiRoot}/maintenance/$i + done + ''; in @@ -89,6 +99,16 @@ in options = { + id = mkOption { + default = "main"; + description = '' + A unique identifier necessary to keep multiple MediaWiki server + instances on the same machine apart. This is used to + disambiguate the administrative scripts, which get names like + mediawiki-$id-change-password. + ''; + }; + dbType = mkOption { default = "postgres"; example = "mysql"; @@ -171,6 +191,8 @@ in }; + extraPath = [ mediawikiScripts ]; + startupScript = pkgs.writeScript "mediawiki_startup.sh" # Initialise the database automagically if we're using a Postgres # server on localhost. @@ -185,4 +207,5 @@ in ) | ${pkgs.postgresql}/bin/psql -U "${config.dbUser}" "${config.dbName}" fi ''); + }