summary refs log tree commit diff
path: root/pkgs/build-support/release/nix-build.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-03-19 03:45:36 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-03-19 03:45:36 +0000
commitebd19ec70548eaece8f5b4c22a966f0fa92ec28f (patch)
treed45d8ea013ee4ddc5a047ea5510ada87d78a3609 /pkgs/build-support/release/nix-build.nix
parent06d28ca8f1e9ef040f9398e4d1a035d40006bd47 (diff)
downloadnixlib-ebd19ec70548eaece8f5b4c22a966f0fa92ec28f.tar
nixlib-ebd19ec70548eaece8f5b4c22a966f0fa92ec28f.tar.gz
nixlib-ebd19ec70548eaece8f5b4c22a966f0fa92ec28f.tar.bz2
nixlib-ebd19ec70548eaece8f5b4c22a966f0fa92ec28f.tar.lz
nixlib-ebd19ec70548eaece8f5b4c22a966f0fa92ec28f.tar.xz
nixlib-ebd19ec70548eaece8f5b4c22a966f0fa92ec28f.tar.zst
nixlib-ebd19ec70548eaece8f5b4c22a966f0fa92ec28f.zip
* For "nix-build --run-env" it's desirable that $stdenv/setup (and by
  extension postHook) does nothing else than set up the environment.
  It shouldn't touch $out because there may not be a $out.  So move
  the "imperative" bits of postHook into a separate phase.

svn path=/nixpkgs/trunk/; revision=33249
Diffstat (limited to 'pkgs/build-support/release/nix-build.nix')
-rw-r--r--pkgs/build-support/release/nix-build.nix19
1 files changed, 11 insertions, 8 deletions
diff --git a/pkgs/build-support/release/nix-build.nix b/pkgs/build-support/release/nix-build.nix
index a8973b9d779b..92f0579e8844 100644
--- a/pkgs/build-support/release/nix-build.nix
+++ b/pkgs/build-support/release/nix-build.nix
@@ -13,6 +13,7 @@
 , src, stdenv
 , name ? if doCoverageAnalysis then "nix-coverage" else "nix-build"
 , failureHook ? null
+, prePhases ? []
 , postPhases ? []
 , ... } @ args:
 
@@ -56,13 +57,6 @@ stdenv.mkDerivation (
     name = name + (if src ? version then "-" + src.version else "");
   
     postHook = ''
-      mkdir -p $out/nix-support
-      echo "$system" > $out/nix-support/system
-
-      if test -z "${toString doCoverageAnalysis}"; then
-          echo "nix-build none $out" >> $out/nix-support/hydra-build-products
-      fi
-
       # If `src' is the result of a call to `makeSourceTarball', then it
       # has a subdirectory containing the actual tarball(s).  If there are
       # multiple tarballs, just pick the first one.
@@ -77,9 +71,18 @@ stdenv.mkDerivation (
           export CFLAGS="-O0"
           export CXXFLAGS="-O0"
       fi
-
     ''; # */
 
+    initPhase = ''
+      mkdir -p $out/nix-support
+      echo "$system" > $out/nix-support/system
+
+      if test -z "${toString doCoverageAnalysis}"; then
+          echo "nix-build none $out" >> $out/nix-support/hydra-build-products
+      fi
+    '';
+
+    prePhases = ["initPhase"] ++ prePhases;
 
     # In the report phase, create a coverage analysis report.
     coverageReportPhase = if doCoverageAnalysis then ''