1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-08 19:45:42 +03:00

* 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 let
inherit (pkgs.lib) mkOption mkIf singleton;
cfg = config.services.postgresql; cfg = config.services.postgresql;
@ -12,7 +13,7 @@ let
run = "${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} postgres"; 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. # The main PostgreSQL configuration file.
configFile = pkgs.writeText "postgresql.conf" configFile = pkgs.writeText "postgresql.conf"

View file

@ -71,6 +71,16 @@ let
cp ${mediawikiConfig} $out/LocalSettings.php 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 in
@ -89,6 +99,16 @@ in
options = { 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 { dbType = mkOption {
default = "postgres"; default = "postgres";
example = "mysql"; example = "mysql";
@ -171,6 +191,8 @@ in
}; };
extraPath = [ mediawikiScripts ];
startupScript = pkgs.writeScript "mediawiki_startup.sh" startupScript = pkgs.writeScript "mediawiki_startup.sh"
# Initialise the database automagically if we're using a Postgres # Initialise the database automagically if we're using a Postgres
# server on localhost. # server on localhost.
@ -185,4 +207,5 @@ in
) | ${pkgs.postgresql}/bin/psql -U "${config.dbUser}" "${config.dbName}" ) | ${pkgs.postgresql}/bin/psql -U "${config.dbUser}" "${config.dbName}"
fi fi
''); '');
} }