svn path=/nixos/trunk/; revision=10643

This commit is contained in:
Eelco Dolstra 2008-02-12 12:56:39 +00:00
parent eca9242918
commit 6e06b11097
2 changed files with 121 additions and 26 deletions

View File

@ -260,6 +260,8 @@ in
} }
]; ];
extraPath = [httpd] ++ pkgs.lib.concatMap (svc: svc.extraPath) subservices;
# Statically verify the syntactic correctness of the generated # Statically verify the syntactic correctness of the generated
# httpd.conf. # httpd.conf.
buildHook = '' buildHook = ''
@ -281,7 +283,7 @@ in
# Get rid of old semaphores. These tend to accumulate across # Get rid of old semaphores. These tend to accumulate across
# server restarts, eventually preventing it from restarting # server restarts, eventually preventing it from restarting
# succesfully. # succesfully.
for i in $(${pkgs.utillinux}/bin/ipcs -s | grep ' wwwrun ' | cut -f2 -d ' '); do for i in $(${pkgs.utillinux}/bin/ipcs -s | grep ' ${cfg.user} ' | cut -f2 -d ' '); do
${pkgs.utillinux}/bin/ipcrm -s $i ${pkgs.utillinux}/bin/ipcrm -s $i
done done
end script end script
@ -291,7 +293,7 @@ in
in pkgs.lib.concatStrings (map f (pkgs.lib.concatMap (svc: svc.globalEnvVars) subservices)) in pkgs.lib.concatStrings (map f (pkgs.lib.concatMap (svc: svc.globalEnvVars) subservices))
} }
env PATH=${pkgs.coreutils}/bin:${pkgs.gnugrep}/bin:${pkgs.lib.concatStringsSep ":" (pkgs.lib.concatMap (svc: svc.extraPath) subservices)} env PATH=${pkgs.coreutils}/bin:${pkgs.gnugrep}/bin:${pkgs.lib.concatStringsSep ":" (pkgs.lib.concatMap (svc: svc.extraServerPath) subservices)}
${pkgs.diffutils}/bin:${pkgs.gnused}/bin ${pkgs.diffutils}/bin:${pkgs.gnused}/bin

View File

@ -7,9 +7,19 @@ let
dbDir = "/tmp/svn/db"; dbDir = "/tmp/svn/db";
reposDir = "/tmp/svn/repos"; reposDir = "/tmp/svn/repos";
backupsDir = "/tmp/svn/backup"; backupsDir = "/tmp/svn/backup";
distsDir = "/tmp/svn/dist";
tmpDir = "/tmp/svn/tmp"; tmpDir = "/tmp/svn/tmp";
logDir = "/tmp/svn/log";
adminAddr = "eelco@cs.uu.nl"; adminAddr = "eelco@cs.uu.nl";
userCreationDomain = "10.0.0.0/8"; userCreationDomain = "10.0.0.0/8";
orgUrl = "http://www.cs.uu.nl/";
orgLogoUrl = "${prefix}/UU_merk.gif";
orgName = "Utrecht University";
postCommitHook = "/var/run/current-system/sw/bin/svn-server-post-commit-hook";
autoVersioning = true;
notificationSender = "root@buildfarm.st.ewi.tudelft.nl";
fsType = "fsfs";
smtpHost = "mail.st.ewi.tudelft.nl";
# Build a Subversion instance with Apache modules and Swig/Python bindings. # Build a Subversion instance with Apache modules and Swig/Python bindings.
@ -24,6 +34,40 @@ let
}; };
# Build the maintenance scripts and commit hooks.
scripts = substituteInAll {
name = "svn-server-scripts";
src = pkgs.lib.cleanSource ../../../services/subversion/src/scripts;
# The variables to substitute:
inherit reposDir dbDir logDir distsDir backupsDir tmpDir
adminAddr notificationSender userCreationDomain fsType
subversion orgUrl orgLogoUrl orgName smtpHost
postCommitHook;
perl = "${pkgs.perl}/bin/perl";
sendmail = "${pkgs.ssmtp}/sbin/sendmail";
urlPrefix = prefix;
inherit (pkgs) libxslt enscript db4 coreutils bzip2;
inherit (serverInfo) canonicalName;
# Urgh, most of these are dependencies of Email::Send, should figure them out automatically.
perlFlags = map (x: "-I${x}/lib/site_perl") [
pkgs.perlBerkeleyDB pkgs.perlEmailSend pkgs.perlEmailSimple
pkgs.perlModulePluggable pkgs.perlReturnValue pkgs.perlEmailAddress
pkgs.perlCryptPasswordMD5 pkgs.perlStringMkPasswd
];
# Do a syntax check on the generated file.
postInstall = "$perl -c -T $out/cgi-bin/repoman.pl; $perl -c $out/bin/svn-server-create-user.pl";
};
# Build our custom authentication modules. # Build our custom authentication modules.
authModules = import ../../../services/subversion/src/auth { authModules = import ../../../services/subversion/src/auth {
inherit (pkgs) stdenv apacheHttpd; inherit (pkgs) stdenv apacheHttpd;
@ -58,7 +102,7 @@ let
DAV svn DAV svn
SVNParentPath ${reposDir} SVNParentPath ${reposDir}
#SVNAutoversioning @autoVersioning@ SVNAutoversioning ${if autoVersioning then "on" else "off"}
''; '';
@ -121,29 +165,27 @@ let
''; '';
# Build Repoman. distConfig = ''
Alias ${prefix}/dist ${distsDir}
repoman = pkgs.substituteAll { <Directory "${distsDir}">
src = ../../../services/subversion/src/repoman/repoman.pl.in; AllowOverride None
dir = "/"; Options Indexes FollowSymLinks
name = "repoman.pl"; Order allow,deny
isExecutable = true; Allow from all
perl = "${pkgs.perl}/bin/perl"; IndexOptions +SuppressDescription +NameWidth=*
defaultPath = ""; IndexIgnore *.rev *.lock
urlPrefix = prefix; IndexStyleSheet ${prefix}/style.css
orgUrl = "http://example.org/"; </Directory>
orgLogoUrl = "http://example.org/";
orgName = "Example Org"; <Location ${prefix}/dist>
inherit (serverInfo) canonicalName; ${viewerConfig "dist"}
fsType = "fsfs"; </Location>
inherit adminAddr reposDir backupsDir dbDir subversion userCreationDomain; '';
# Urgh, most of these are dependencies of Email::Send, should figure them out automatically.
perlFlags = "-I${pkgs.perlBerkeleyDB}/lib/site_perl -I${pkgs.perlEmailSend}/lib/site_perl -I${pkgs.perlEmailSimple}/lib/site_perl -I${pkgs.perlModulePluggable}/lib/site_perl -I${pkgs.perlReturnValue}/lib/site_perl -I${pkgs.perlEmailAddress}/lib/site_perl";
};
repomanConfig = '' repomanConfig = ''
ScriptAlias ${prefix}/repoman ${repoman}/repoman.pl ScriptAlias ${prefix}/repoman ${scripts}/cgi-bin/repoman.pl
<Location ${prefix}/repoman/listdetails> <Location ${prefix}/repoman/listdetails>
${commonAuth} ${commonAuth}
@ -182,9 +224,52 @@ let
''; '';
# !!! staticFiles = substituteInSome {
name = "svn-static-files";
src = pkgs.lib.cleanSource ../../../services/subversion/root;
urlPrefix = prefix;
files = ["xsl/svnindex.xsl"];
};
staticFilesConfig = ''
Alias ${prefix} ${staticFiles}
<Directory ${staticFiles}>
Order allow,deny
Allow from all
AllowOverride None
DirectoryIndex repoman
</Directory>
'';
# !!! should be in Nixpkgs.
writeTextInDir = name: text: writeTextInDir = name: text:
pkgs.runCommand name {inherit text;} "ensureDir $out; echo -n \"$text\" > $out/$name"; pkgs.runCommand name {inherit text;} ''ensureDir $out; echo -n "$text" > $out/$name'';
substituteInSome = args: pkgs.stdenv.mkDerivation ({
buildCommand = ''
buildCommand= # ugh, hack to prevent sed errors
ensureDir $out
cp -prd $src/* $out
chmod -R u+w $out
for i in $files; do
substituteAll $out/$i $out/$i
done
'';
} // args); # */
substituteInAll = args: pkgs.stdenv.mkDerivation ({
buildCommand = ''
buildCommand= # ugh, hack to prevent sed errors
ensureDir $out
cp -prd $src/* $out
chmod -R u+w $out
find $out -type f -print | while read fn; do
substituteAll $fn $fn
done
eval "$postInstall"
'';
} // args); # */
in in
@ -207,6 +292,8 @@ in
extraConfig = '' extraConfig = ''
#RedirectPermanent ^${prefix}$ ${prefix}/repoman
<AuthnProviderAlias dbm auth-against-db> <AuthnProviderAlias dbm auth-against-db>
AuthDBMType DB AuthDBMType DB
AuthDBMUserFile ${dbDir}/svn-users AuthDBMUserFile ${dbDir}/svn-users
@ -227,6 +314,10 @@ in
${repomanConfig} ${repomanConfig}
${distConfig}
${staticFilesConfig}
''; '';
robotsEntries = '' robotsEntries = ''
@ -243,10 +334,12 @@ in
{ name = "PYTHONPATH"; value = "${pkgs.mod_python}/lib/python2.4/site-packages"; } { name = "PYTHONPATH"; value = "${pkgs.mod_python}/lib/python2.4/site-packages"; }
]; ];
extraPath = [ extraServerPath = [
# Needed for ViewVC. # Needed for ViewVC.
"${pkgs.diffutils}/bin" "${pkgs.diffutils}/bin"
"${pkgs.gnused}/bin" "${pkgs.gnused}/bin"
]; ];
extraPath = [scripts];
} }