* Create a user "mediawiki" and give root and wwwrun ident-based

access.

svn path=/nixos/trunk/; revision=18779
This commit is contained in:
Eelco Dolstra 2009-12-03 11:56:03 +00:00
parent c7e0a7b31c
commit 9f8fc09fc3
2 changed files with 14 additions and 3 deletions

View File

@ -63,6 +63,7 @@ in
authentication = mkOption {
default = ''
# Generated file; do not edit!
local all mediawiki ident mediawiki-users
local all all ident sameuser
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
@ -113,6 +114,13 @@ in
environment.systemPackages = [postgresql];
# !!! This should be be in the mediawiki module, obviously.
services.postgresql.identMap =
''
mediawiki-users root mediawiki
mediawiki-users wwwrun mediawiki
'';
jobs.postgresql =
{ description = "PostgreSQL server";

View File

@ -111,8 +111,7 @@ in
};
dbUser = mkOption {
default = "wwwrun";
example = "mediawiki";
default = "mediawiki";
description = "The user name for accessing the database.";
};
@ -179,7 +178,11 @@ in
if ! ${pkgs.postgresql}/bin/psql -l | grep -q ' ${config.dbName} ' ; then
${pkgs.postgresql}/bin/createuser --no-superuser --no-createdb --no-createrole "${config.dbUser}" || true
${pkgs.postgresql}/bin/createdb "${config.dbName}" -O "${config.dbUser}"
${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} "${config.dbUser}" -c "(echo 'CREATE LANGUAGE plpgsql;'; cat ${mediawikiRoot}/maintenance/postgres/tables.sql; echo 'CREATE TEXT SEARCH CONFIGURATION public.default ( COPY = pg_catalog.english );'; echo COMMIT) | ${pkgs.postgresql}/bin/psql ${config.dbName}"
( echo 'CREATE LANGUAGE plpgsql;'
cat ${mediawikiRoot}/maintenance/postgres/tables.sql
echo 'CREATE TEXT SEARCH CONFIGURATION public.default ( COPY = pg_catalog.english );'
echo COMMIT
) | ${pkgs.postgresql}/bin/psql -U "${config.dbUser}" "${config.dbName}"
fi
'');
}