1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-14 22:42:41 +01:00

* Dirty interim hack to make header file dependency determination

reliable (if somewhat inefficient): make the current time an
  attribute of the derivation.  Thus, every call to `nix-build' will
  cause the find-includes derivation to be re-done (but not the actual
  compilations if that's not necessary!).  I added a `curTime' primop
  to do this.
This commit is contained in:
Eelco Dolstra 2004-07-06 16:33:46 +00:00
parent 7d386d5c29
commit af54a60204
4 changed files with 22 additions and 3 deletions

View file

@ -5,7 +5,12 @@ rec {
compileC = {main, localIncludes ? []}: stdenv.mkDerivation {
name = "compile-c";
builder = ./compile-c.sh;
inherit main localIncludes;
localIncludes =
if localIncludes == "auto" then
import (findIncludes {main = toString main; hack = curTime;})
else
localIncludes;
inherit main;
};
/*
@ -16,10 +21,10 @@ rec {
};
*/
findIncludes = {main}: stdenv.mkDerivation {
findIncludes = {main, hack}: stdenv.mkDerivation {
name = "find-includes";
builder = ./find-includes.sh;
inherit main;
inherit main hack;
};
link = {objects, programName ? "program"}: stdenv.mkDerivation {

View file

@ -28,6 +28,7 @@ EvalState::EvalState()
addPrimOp0("true", primTrue);
addPrimOp0("false", primFalse);
addPrimOp0("null", primNull);
addPrimOp0("curTime", primCurTime);
addPrimOp1("import", primImport);
addPrimOp1("derivation", primDerivation);

View file

@ -1,3 +1,5 @@
#include <time.h>
#include "primops.hh"
#include "normalise.hh"
#include "globals.hh"
@ -321,3 +323,9 @@ Expr primIsNull(EvalState & state, Expr arg)
ATMatcher m;
return makeBool(atMatch(m, arg) >> "Null");
}
Expr primCurTime(EvalState & state)
{
return ATmake("Int(<int>)", time(0));
}

View file

@ -34,5 +34,10 @@ Expr primNull(EvalState & state);
/* Determine whether the argument is the null value. */
Expr primIsNull(EvalState & state, Expr arg);
/* Return the current time. !!! hack, impure - although due to
memoization of evaluation results this should always yield the same
value for a particular run of the program. */
Expr primCurTime(EvalState & state);
#endif /* !__PRIMOPS_H */