From 2d89fb4fee9e41c2aa6b8871db59f3cda60254c5 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Fri, 20 Feb 2009 15:40:11 +0000
Subject: [PATCH] * Support a post-install hook.

svn path=/nixpkgs/trunk/; revision=14142
---
 pkgs/build-support/buildenv/builder.pl  | 4 ++++
 pkgs/build-support/buildenv/default.nix | 8 +++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/pkgs/build-support/buildenv/builder.pl b/pkgs/build-support/buildenv/builder.pl
index eb8490080558..2da4311b3887 100755
--- a/pkgs/build-support/buildenv/builder.pl
+++ b/pkgs/build-support/buildenv/builder.pl
@@ -165,3 +165,7 @@ my $manifest = $ENV{"manifest"};
 if ($manifest ne "") {
     symlink($manifest, "$out/manifest") or die "cannot create manifest";
 }
+
+
+system("eval \"\$postBuild\"") == 0
+    or die "post-build hook failed";
diff --git a/pkgs/build-support/buildenv/default.nix b/pkgs/build-support/buildenv/default.nix
index 95f5f2304c01..abe2f37ec660 100644
--- a/pkgs/build-support/buildenv/default.nix
+++ b/pkgs/build-support/buildenv/default.nix
@@ -20,11 +20,13 @@
   # symlink (e.g., ["/bin"]).  Any file not inside any of the
   # directories in the list is not symlinked.
   pathsToLink ? ["/"]
+
+, # Shell command to run after building the symlink tree.
+  postBuild ? ""
 }:
 
 stdenv.mkDerivation {
-  inherit name manifest paths ignoreCollisions pathsToLink;
-  realBuilder = perl + "/bin/perl";
+  inherit name manifest paths ignoreCollisions pathsToLink postBuild;
+  realBuilder = "${perl}/bin/perl";
   args = ["-w" ./builder.pl];
 }
-