diff --git a/nix/default.nix b/nix/default.nix
index 01cfbcac8b0a3ffddd914e40bb698389e0a86619..e6718411b5a9cb7867c177d8deaf79d84c204bc3 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -140,9 +140,6 @@ pkgs.lib.makeExtensible
         buildInputs = self.buildInputs;
         opamPackages = [ "headache=1.05" ];
         outputs = [ "out" ];
-        postPatch = ''
-               patchShebangs .
-        '';
         configurePhase = ''
                unset CC
                autoconf
@@ -165,6 +162,9 @@ pkgs.lib.makeExtensible
         opamPackages = self.build-distrib-tarball.opamPackages;
         src = self.build-distrib-tarball.out ;
         outputs = [ "out" ];
+        postPatch = ''
+               patchShebangs .
+        '';
         configurePhase = ''
                unset CC
                autoconf
diff --git a/share/analysis-scripts/analysis.mk b/share/analysis-scripts/analysis.mk
index 3483b89d6d4689e36703eebed525d4ff2f79223a..2c97f34cc84c837539a834d42a7d89dded7e18eb 100644
--- a/share/analysis-scripts/analysis.mk
+++ b/share/analysis-scripts/analysis.mk
@@ -84,9 +84,10 @@ define time_with_output
 endef
 endif
 else
-ifneq (,$(wildcard /usr/bin/time))
+TIMEBIN:=$(shell which -a time | grep '^/')
+ifneq (,$(TIMEBIN))
 define time_with_output
-  /usr/bin/time -f 'user_time=%U\nmemory=%M' -o "$(1)"
+  $(TIMEBIN) -f 'user_time=%U\nmemory=%M' -o "$(1)"
 endef
 else
 define time_with_output