Skip to content
Snippets Groups Projects
Commit 34fcf5fa authored by Eelco Dolstra's avatar Eelco Dolstra
Browse files

* Started integrating the new evaluation model into Nix.

* Cleaned up command-line syntax.
parent 7a96da36
No related branches found
No related tags found
No related merge requests found
...@@ -10,5 +10,11 @@ AC_CANONICAL_HOST ...@@ -10,5 +10,11 @@ AC_CANONICAL_HOST
AC_PROG_CC AC_PROG_CC
AC_PROG_CXX AC_PROG_CXX
# Unix shell scripting should die a slow and painful death.
AC_DEFINE_UNQUOTED(NIX_VALUES_DIR, "$(eval echo $prefix/values)", Nix values directory.)
AC_DEFINE_UNQUOTED(NIX_STATE_DIR, "$(eval echo $localstatedir/nix)", Nix state directory.)
AC_DEFINE_UNQUOTED(NIX_LOG_DIR, "$(eval echo $localstatedir/log/nix)", Nix log file directory.)
AC_CONFIG_HEADER([config.h])
AC_CONFIG_FILES([Makefile src/Makefile scripts/Makefile]) AC_CONFIG_FILES([Makefile src/Makefile scripts/Makefile])
AC_OUTPUT AC_OUTPUT
bin_PROGRAMS = nix fix bin_PROGRAMS = nix # fix
noinst_PROGRAMS = test noinst_PROGRAMS = test
AM_CXXFLAGS = -DSYSTEM=\"@host@\" -Wall AM_CXXFLAGS = -DSYSTEM=\"@host@\" -Wall -I..
nix_SOURCES = nix.cc db.cc util.cc hash.cc md5.c nix_SOURCES = nix.cc util.cc hash.cc md5.c eval.cc values.cc globals.cc db.cc
nix_LDADD = -ldb_cxx-4 -lATerm nix_LDADD = -ldb_cxx-4 -lATerm
fix_SOURCES = fix.cc util.cc hash.cc md5.c fix_SOURCES = fix.cc util.cc hash.cc md5.c
...@@ -20,4 +20,4 @@ install-data-local: ...@@ -20,4 +20,4 @@ install-data-local:
# $(INSTALL) -d $(localstatedir)/nix/prebuilts/exports # $(INSTALL) -d $(localstatedir)/nix/prebuilts/exports
$(INSTALL) -d $(localstatedir)/log/nix $(INSTALL) -d $(localstatedir)/log/nix
$(INSTALL) -d $(prefix)/values $(INSTALL) -d $(prefix)/values
$(bindir)/nix init $(bindir)/nix --init
...@@ -279,7 +279,7 @@ Expr evalValue(Expr e) ...@@ -279,7 +279,7 @@ Expr evalValue(Expr e)
string fn = queryValuePath(evalHash(e2)); string fn = queryValuePath(evalHash(e2));
ATerm e3 = ATreadFromNamedFile(fn.c_str()); ATerm e3 = ATreadFromNamedFile(fn.c_str());
if (!e3) throw Error("reading aterm from " + fn); if (!e3) throw Error("reading aterm from " + fn);
return e3; return evalValue(e3);
} }
/* Execution primitive. */ /* Execution primitive. */
...@@ -298,8 +298,8 @@ Expr evalValue(Expr e) ...@@ -298,8 +298,8 @@ Expr evalValue(Expr e)
evalArgs(args, argsNF, env); evalArgs(args, argsNF, env);
Hash sourceHash = hashExpr( Hash sourceHash = hashExpr(
ATmake("Exec(Str(<str>), Hash(<str>), [])", ATmake("Exec(Str(<str>), Hash(<str>), <term>)",
buildPlatform.c_str(), ((string) prog).c_str())); buildPlatform.c_str(), ((string) prog).c_str(), argsNF));
/* Do we know a normal form for sourceHash? */ /* Do we know a normal form for sourceHash? */
Hash targetHash; Hash targetHash;
......
This diff is collapsed.
...@@ -19,6 +19,8 @@ static string absValuePath(string s) ...@@ -19,6 +19,8 @@ static string absValuePath(string s)
Hash addValue(string path) Hash addValue(string path)
{ {
path = absPath(path);
Hash hash = hashPath(path); Hash hash = hashPath(path);
string name; string name;
...@@ -79,7 +81,7 @@ string queryValuePath(Hash hash) ...@@ -79,7 +81,7 @@ string queryValuePath(Hash hash)
return fn; return fn;
} }
throw Error("a file with hash " + (string) hash + " is requested, " throw Error("a file with hash " + (string) hash + " is required, "
"but it is not known to exist locally or on the network"); "but it is not known to exist locally or on the network");
#if 0 #if 0
if (checkedNet) if (checkedNet)
...@@ -87,7 +89,7 @@ string queryValuePath(Hash hash) ...@@ -87,7 +89,7 @@ string queryValuePath(Hash hash)
" should have hash " + (string) hash + ", but it doesn't"); " should have hash " + (string) hash + ", but it doesn't");
if (!queryDB(nixDB, dbNetSources, hash, url)) if (!queryDB(nixDB, dbNetSources, hash, url))
throw Error("a file with hash " + (string) hash + " is requested, " throw Error("a file with hash " + (string) hash + " is required, "
"but it is not known to exist locally or on the network"); "but it is not known to exist locally or on the network");
checkedNet = true; checkedNet = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment