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

View file

@ -109,10 +109,6 @@ let
minimal_install_archive = {system ? "i686-linux"}: (iso_minimal {inherit system;})
.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 =
{ services ? ../services }:
let

View file

@ -64,7 +64,7 @@
$webserver->waitForFile("/var/trac");
$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->execute("konqueror http://webserver/projects/test &");