diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-07-30T23·55-0400 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-07-30T23·55-0400 |
commit | 97421eb5ecde86b75441094fda017b12b5eca2a6 (patch) | |
tree | 97ab7442b5bf13363320b4facb50d2f3e384d8ed /src/libexpr | |
parent | d50d7a287416da2086b0b24f9d998eabb24c1734 (diff) |
Refactor settings processing
Put all Nix configuration flags in a Settings object.
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/eval.cc | 4 | ||||
-rw-r--r-- | src/libexpr/primops.cc | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index cf7c62ad20cf..74f7560fe0ea 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -179,7 +179,7 @@ EvalState::EvalState() searchPathInsertionPoint = searchPath.end(); Strings paths = tokenizeString(getEnv("NIX_PATH", ""), ":"); foreach (Strings::iterator, i, paths) addToSearchPath(*i); - addToSearchPath("nix=" + nixDataDir + "/nix/corepkgs"); + addToSearchPath("nix=" + settings.nixDataDir + "/nix/corepkgs"); searchPathInsertionPoint = searchPath.begin(); createBaseEnv(); @@ -1058,7 +1058,7 @@ string EvalState::coerceToString(Value & v, PathSet & context, if (srcToStore[path] != "") dstPath = srcToStore[path]; else { - dstPath = readOnlyMode + dstPath = settings.readOnlyMode ? computeStorePathForPath(path).first : store->addToStore(path); srcToStore[path] = dstPath; diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 5c011c43e31c..7258c4cc0fa9 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -623,7 +623,7 @@ static void prim_toFile(EvalState & state, Value * * args, Value & v) refs.insert(path); } - Path storePath = readOnlyMode + Path storePath = settings.readOnlyMode ? computeStorePathForText(name, contents, refs) : store->addTextToStore(name, contents, refs); @@ -687,7 +687,7 @@ static void prim_filterSource(EvalState & state, Value * * args, Value & v) FilterFromExpr filter(state, *args[0]); - Path dstPath = readOnlyMode + Path dstPath = settings.readOnlyMode ? computeStorePathForPath(path, true, htSHA256, filter).first : store->addToStore(path, true, htSHA256, filter); @@ -1079,7 +1079,7 @@ void EvalState::createBaseEnv() mkInt(v, time(0)); addConstant("__currentTime", v); - mkString(v, thisSystem.c_str()); + mkString(v, settings.thisSystem.c_str()); addConstant("__currentSystem", v); // Miscellaneous |