* Make various MediaWiki scripts available in $PATH,

e.g. mediawiki-<id>-changePassword (where <id> is usually "main").

svn path=/nixos/trunk/; revision=18780
This commit is contained in:
Eelco Dolstra 2009-12-03 12:20:24 +00:00
parent 9f8fc09fc3
commit aacd16cff0
2 changed files with 27 additions and 3 deletions

View File

@ -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"

View File

@ -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
'');
}