From ffd96f07fe0cded03d26b4f82bf379d2685b92f8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 14 Feb 2008 14:29:21 +0000 Subject: [PATCH] svn path=/nixos/trunk/; revision=10689 --- upstart-jobs/apache-httpd/dist-manager.nix | 102 +++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 upstart-jobs/apache-httpd/dist-manager.nix diff --git a/upstart-jobs/apache-httpd/dist-manager.nix b/upstart-jobs/apache-httpd/dist-manager.nix new file mode 100644 index 00000000000..543f075d17e --- /dev/null +++ b/upstart-jobs/apache-httpd/dist-manager.nix @@ -0,0 +1,102 @@ +{config, pkgs, serverInfo}: + +let + + inherit (pkgs.lib) mkOption; + + urlPrefix = "/release"; + distDir = "/tmp/dist"; + distConfDir = "/tmp/dist-conf"; + + staticFiles = substituteInAll { + name = "svn-server-scripts"; + src = pkgs.lib.cleanSource ../../../services/dist-manager/files; + + perl = "${pkgs.perl}/bin/perl"; + + inherit (serverInfo) canonicalName; + + inherit urlPrefix; + + defaultPath = ""; # !!! + + # Do a syntax check on the generated file. + postInstall = '' + $perl -c $out/cgi-bin/create-dist.pl # !!! should use -T + ''; + }; + + # !!! cut&paste + substituteInAll = args: pkgs.stdenvUsingSetupNew2.mkDerivation ({ + buildCommand = '' + 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 { + + extraConfig = '' + + Alias ${urlPrefix}/css ${staticFiles}/css + + + ScriptAlias ${urlPrefix}/cgi-bin ${staticFiles}/cgi-bin + + + AllowOverride FileInfo AuthConfig Limit + Options MultiViews SymLinksIfOwnerMatch ExecCGI + SetHandler cgi-script + + # !!! this shouldn't be here + Order allow,deny + Allow from 131.211.0.0/255.255.0.0 # *.cs.uu.nl + Allow from 130.145.0.0/255.255.0.0 # philips.com + Allow from 130.161.158.181 # TUD supervisor + Allow from 192.168.1.0/24 # TUD builders + Allow from 127.0.0.1 + + Require valid-user + AuthType Basic + AuthName "Nix Upload" + AuthUserFile ${distConfDir}/upload_passwords + + + + Alias ${urlPrefix} ${distDir}/ + + + Options +Indexes + + RewriteEngine on + RewriteRule ^${distDir}/(.*)/create-dist/(.*) ${urlPrefix}/cgi-bin/create-dist.pl/$1/$2 + + AddType application/nix-package .nixpkg + + + + AllowOverride FileInfo AuthConfig Limit + Order allow,deny + Allow from all + + + ''; + + # !!! should not be needed + extraModulesPre = []; + extraModules = []; + robotsEntries = ""; + globalEnvVars = []; + extraServerPath = []; + extraPath = []; + + options = { + + }; + +} \ No newline at end of file