diff --git a/modules/services/web-servers/apache-httpd/subversion.nix b/modules/services/web-servers/apache-httpd/subversion.nix index d9febdf44c01..e10156432dc3 100644 --- a/modules/services/web-servers/apache-httpd/subversion.nix +++ b/modules/services/web-servers/apache-httpd/subversion.nix @@ -137,7 +137,7 @@ let 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"} @@ -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"; } ]; diff --git a/modules/services/web-servers/apache-httpd/trac.nix b/modules/services/web-servers/apache-httpd/trac.nix index d5588e1162c0..61cb2fbca043 100644 --- a/modules/services/web-servers/apache-httpd/trac.nix +++ b/modules/services/web-servers/apache-httpd/trac.nix @@ -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 = '' @@ -57,29 +63,31 @@ in ''; - 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)} ''; + } diff --git a/release.nix b/release.nix index de9fb2a5fe2d..91aa722e2a94 100644 --- a/release.nix +++ b/release.nix @@ -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 diff --git a/tests/trac.nix b/tests/trac.nix index 4a2fc665bf77..59f19310dee9 100644 --- a/tests/trac.nix +++ b/tests/trac.nix @@ -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 &");