* "python2.5" -> ${pkgs.python.libPrefix}

svn path=/nixos/trunk/; revision=19901
This commit is contained in:
Eelco Dolstra 2010-02-10 12:39:47 +00:00
parent c04d68b898
commit 07cc5ac2fd
4 changed files with 37 additions and 33 deletions

View File

@ -137,7 +137,7 @@ let
<Location ${urlPrefix}/viewvc> <Location ${urlPrefix}/viewvc>
AddHandler python-program .py AddHandler python-program .py
# Note: we write \" instead of ' to work around a lexer bug in Nix 0.11. # Note: we write \" instead of ' to work around a lexer bug in Nix 0.11.
PythonPath "[\"${viewvc}/viewvc/bin/mod_python\", \"${subversion}/lib/python2.5/site-packages\"] + sys.path" PythonPath "[\"${viewvc}/viewvc/bin/mod_python\", \"${subversion}/lib/${pkgs.python.libPrefix}/site-packages\"] + sys.path"
PythonHandler handler PythonHandler handler
${viewerConfig "viewvc"} ${viewerConfig "viewvc"}
</Location> </Location>
@ -333,7 +333,7 @@ in {
# mod_python's own Python modules must be in the initial Python # mod_python's own Python modules must be in the initial Python
# path, they cannot be set through the PythonPath directive. # path, they cannot be set through the PythonPath directive.
globalEnvVars = [ globalEnvVars = [
{ name = "PYTHONPATH"; value = "${pkgs.mod_python}/lib/python2.5/site-packages"; } { name = "PYTHONPATH"; value = "${pkgs.mod_python}/lib/${pkgs.python.libPrefix}/site-packages"; }
]; ];

View File

@ -1,7 +1,8 @@
{ config, pkgs, serverInfo, ... }: { config, pkgs, serverInfo, ... }:
with pkgs.lib;
let let
inherit (pkgs.lib) mkOption;
# Build a Subversion instance with Apache modules and Swig/Python bindings. # Build a Subversion instance with Apache modules and Swig/Python bindings.
subversion = pkgs.subversion.override (origArgs: { subversion = pkgs.subversion.override (origArgs: {
@ -11,9 +12,15 @@ let
compressionSupport = true; compressionSupport = true;
pythonBindings = true; pythonBindings = true;
}); });
pythonLib = p: "${p}/";
in in
{ {
options = { options = {
projectsLocation = mkOption { projectsLocation = mkOption {
description = "URL path in which Trac projects can be accessed"; description = "URL path in which Trac projects can be accessed";
default = "/projects"; default = "/projects";
@ -22,30 +29,29 @@ in
projects = mkOption { projects = mkOption {
description = "List of projects that should be provided by Trac. If they are not defined yet empty projects are created."; description = "List of projects that should be provided by Trac. If they are not defined yet empty projects are created.";
default = []; default = [];
example = [ { identifier = "myproject"; example =
name = "My Project"; [ { identifier = "myproject";
databaseURL="postgres://root:password@/tracdb"; name = "My Project";
subversionRepository="/data/subversion/myproject"; } ]; databaseURL="postgres://root:password@/tracdb";
subversionRepository="/data/subversion/myproject";
}
];
}; };
user = mkOption { user = mkOption {
default = "wwwrun"; default = "wwwrun";
description = " description = "User account under which Trac runs.";
User account under which Trac runs.
";
}; };
group = mkOption { group = mkOption {
default = "wwwrun"; default = "wwwrun";
description = " description = "Group under which Trac runs.";
Group under which Trac runs.
";
}; };
}; };
extraModules = [ extraModules = singleton
{ name = "python"; path = "${pkgs.mod_python}/modules/mod_python.so"; } { name = "python"; path = "${pkgs.mod_python}/modules/mod_python.so"; };
];
extraConfig = '' extraConfig = ''
<Location ${config.projectsLocation}> <Location ${config.projectsLocation}>
@ -57,29 +63,31 @@ in
</Location> </Location>
''; '';
globalEnvVars = [ globalEnvVars = singleton
{ name = "PYTHONPATH"; { name = "PYTHONPATH";
value = value =
"${pkgs.mod_python}/lib/python2.5/site-packages:" + makeSearchPath "lib/${pkgs.python.libPrefix}/site-packages"
"${pkgs.pythonPackages.trac}/lib/python2.5/site-packages:" + [ pkgs.mod_python
"${pkgs.setuptools}/lib/python2.5/site-packages:" + pkgs.pythonPackages.trac
"${pkgs.pythonPackages.genshi}/lib/python2.5/site-packages:" + pkgs.setuptools
"${pkgs.pythonPackages.psycopg2}/lib/python2.5/site-packages:" + pkgs.pythonPackages.genshi
"${subversion}/lib/python2.5/site-packages"; pkgs.pythonPackages.psycopg2
} subversion
]; ];
};
startupScript = pkgs.writeScript "activateTrac" '' startupScript = pkgs.writeScript "activateTrac" ''
mkdir -p /var/trac mkdir -p /var/trac
chown ${config.user}:${config.group} /var/trac chown ${config.user}:${config.group} /var/trac
${pkgs.lib.concatMapStrings (project: ${concatMapStrings (project:
'' ''
if [ ! -d /var/trac/${project.identifier} ] if [ ! -d /var/trac/${project.identifier} ]
then then
export PYTHONPATH=${pkgs.pythonPackages.psycopg2}/lib/python2.5/site-packages export PYTHONPATH=${pkgs.pythonPackages.psycopg2}/lib/${pkgs.python.libPrefix}/site-packages
${pkgs.pythonPackages.trac}/bin/trac-admin /var/trac/${project.identifier} initenv "${project.name}" "${project.databaseURL}" svn "${project.subversionRepository}" ${pkgs.pythonPackages.trac}/bin/trac-admin /var/trac/${project.identifier} initenv "${project.name}" "${project.databaseURL}" svn "${project.subversionRepository}"
fi fi
'' ) (config.projects)} '' ) (config.projects)}
''; '';
} }

View File

@ -109,10 +109,6 @@ let
minimal_install_archive = {system ? "i686-linux"}: (iso_minimal {inherit system;}) minimal_install_archive = {system ? "i686-linux"}: (iso_minimal {inherit system;})
.config.system.build.minimalInstallArchive; .config.system.build.minimalInstallArchive;
# the archive installer can't be tested without chroot which requires being root
# options: run in kvm or uml ?
# TODO
tests = tests =
{ services ? ../services }: { services ? ../services }:
let let

View File

@ -64,7 +64,7 @@
$webserver->waitForFile("/var/trac"); $webserver->waitForFile("/var/trac");
$webserver->mustSucceed("mkdir -p /var/trac/projects/test"); $webserver->mustSucceed("mkdir -p /var/trac/projects/test");
$webserver->mustSucceed("PYTHONPATH=${pkgs.pythonPackages.psycopg2}/lib/python2.5/site-packages trac-admin /var/trac/projects/test initenv Test postgres://root\@postgresql/trac svn /repos/trac"); $webserver->mustSucceed("PYTHONPATH=${pkgs.pythonPackages.psycopg2}/lib/${pkgs.python.libPrefix}/site-packages trac-admin /var/trac/projects/test initenv Test postgres://root\@postgresql/trac svn /repos/trac");
$client->waitForX; $client->waitForX;
$client->execute("konqueror http://webserver/projects/test &"); $client->execute("konqueror http://webserver/projects/test &");