about summary refs log tree commit diff
path: root/third_party/nix/src/libexpr
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/libexpr')
-rw-r--r--third_party/nix/src/libexpr/attr-path.cc6
-rw-r--r--third_party/nix/src/libexpr/attr-path.hh2
-rw-r--r--third_party/nix/src/libexpr/attr-set.hh7
-rw-r--r--third_party/nix/src/libexpr/common-eval-args.cc2
-rw-r--r--third_party/nix/src/libexpr/common-eval-args.hh2
-rw-r--r--third_party/nix/src/libexpr/eval.cc63
-rw-r--r--third_party/nix/src/libexpr/eval.hh33
-rw-r--r--third_party/nix/src/libexpr/get-drvs.cc33
-rw-r--r--third_party/nix/src/libexpr/get-drvs.hh46
-rw-r--r--third_party/nix/src/libexpr/json-to-value.cc10
-rw-r--r--third_party/nix/src/libexpr/json-to-value.hh2
-rw-r--r--third_party/nix/src/libexpr/lexer.l2
-rw-r--r--third_party/nix/src/libexpr/names.cc12
-rw-r--r--third_party/nix/src/libexpr/names.hh10
-rw-r--r--third_party/nix/src/libexpr/nixexpr.cc4
-rw-r--r--third_party/nix/src/libexpr/nixexpr.hh11
-rw-r--r--third_party/nix/src/libexpr/parser.y18
-rw-r--r--third_party/nix/src/libexpr/primops.cc83
-rw-r--r--third_party/nix/src/libexpr/primops/context.cc6
-rw-r--r--third_party/nix/src/libexpr/primops/fetchGit.cc2
-rw-r--r--third_party/nix/src/libexpr/primops/fetchMercurial.cc4
-rw-r--r--third_party/nix/src/libexpr/symbol-table.cc2
-rw-r--r--third_party/nix/src/libexpr/symbol-table.hh4
-rw-r--r--third_party/nix/src/libexpr/value-to-xml.cc3
-rw-r--r--third_party/nix/src/libexpr/value.hh11
25 files changed, 195 insertions, 183 deletions
diff --git a/third_party/nix/src/libexpr/attr-path.cc b/third_party/nix/src/libexpr/attr-path.cc
index b9b9106be856..3a467504aa63 100644
--- a/third_party/nix/src/libexpr/attr-path.cc
+++ b/third_party/nix/src/libexpr/attr-path.cc
@@ -5,9 +5,9 @@
 
 namespace nix {
 
-static Strings parseAttrPath(const string& s) {
+static Strings parseAttrPath(const std::string& s) {
   Strings res;
-  string cur;
+  std::string cur;
   string::const_iterator i = s.begin();
   while (i != s.end()) {
     if (*i == '.') {
@@ -36,7 +36,7 @@ static Strings parseAttrPath(const string& s) {
   return res;
 }
 
-Value* findAlongAttrPath(EvalState& state, const string& attrPath,
+Value* findAlongAttrPath(EvalState& state, const std::string& attrPath,
                          Bindings& autoArgs, Value& vIn) {
   Strings tokens = parseAttrPath(attrPath);
 
diff --git a/third_party/nix/src/libexpr/attr-path.hh b/third_party/nix/src/libexpr/attr-path.hh
index 6b22df622486..889c2158d79e 100644
--- a/third_party/nix/src/libexpr/attr-path.hh
+++ b/third_party/nix/src/libexpr/attr-path.hh
@@ -7,7 +7,7 @@
 
 namespace nix {
 
-Value* findAlongAttrPath(EvalState& state, const string& attrPath,
+Value* findAlongAttrPath(EvalState& state, const std::string& attrPath,
                          Bindings& autoArgs, Value& vIn);
 
 }
diff --git a/third_party/nix/src/libexpr/attr-set.hh b/third_party/nix/src/libexpr/attr-set.hh
index c62c3c690d24..5357e58a1dec 100644
--- a/third_party/nix/src/libexpr/attr-set.hh
+++ b/third_party/nix/src/libexpr/attr-set.hh
@@ -4,6 +4,7 @@
 
 #include "nixexpr.hh"
 #include "symbol-table.hh"
+#include "types.hh"  // TODO(tazjin): audit this include
 
 namespace nix {
 
@@ -13,8 +14,8 @@ struct Value;
 /* Map one attribute name to its value. */
 struct Attr {
   Symbol name;
-  Value* value;
-  Pos* pos;
+  Value* value;  // TODO(tazjin): Who owns this?
+  Pos* pos;      // TODO(tazjin): Who owns this?
   Attr(Symbol name, Value* value, Pos* pos = &noPos)
       : name(name), value(value), pos(pos){};
   Attr() : pos(&noPos){};
@@ -74,7 +75,7 @@ class Bindings {
       res.emplace_back(&attrs[n]);
     }
     std::sort(res.begin(), res.end(), [](const Attr* a, const Attr* b) {
-      return (const string&)a->name < (const string&)b->name;
+      return (const std::string&)a->name < (const std::string&)b->name;
     });
     return res;
   }
diff --git a/third_party/nix/src/libexpr/common-eval-args.cc b/third_party/nix/src/libexpr/common-eval-args.cc
index 398d42b3557a..8b650690f25c 100644
--- a/third_party/nix/src/libexpr/common-eval-args.cc
+++ b/third_party/nix/src/libexpr/common-eval-args.cc
@@ -48,7 +48,7 @@ Bindings* MixEvalArgs::getAutoArgs(EvalState& state) {
   return res;
 }
 
-Path lookupFileArg(EvalState& state, string s) {
+Path lookupFileArg(EvalState& state, std::string s) {
   if (isUri(s)) {
     CachedDownloadRequest request(s);
     request.unpack = true;
diff --git a/third_party/nix/src/libexpr/common-eval-args.hh b/third_party/nix/src/libexpr/common-eval-args.hh
index 9663d40c148c..dad30daf6b13 100644
--- a/third_party/nix/src/libexpr/common-eval-args.hh
+++ b/third_party/nix/src/libexpr/common-eval-args.hh
@@ -19,6 +19,6 @@ struct MixEvalArgs : virtual Args {
   std::map<std::string, std::string> autoArgs;
 };
 
-Path lookupFileArg(EvalState& state, string s);
+Path lookupFileArg(EvalState& state, std::string s);
 
 }  // namespace nix
diff --git a/third_party/nix/src/libexpr/eval.cc b/third_party/nix/src/libexpr/eval.cc
index 5896bc96e379..875dab2ee709 100644
--- a/third_party/nix/src/libexpr/eval.cc
+++ b/third_party/nix/src/libexpr/eval.cc
@@ -256,7 +256,7 @@ void initGC() {
 
 /* Very hacky way to parse $NIX_PATH, which is colon-separated, but
    can contain URLs (e.g. "nixpkgs=https://bla...:foo=https://"). */
-static Strings parseNixPath(const string& s) {
+static Strings parseNixPath(const std::string& s) {
   Strings res;
 
   auto p = s.begin();
@@ -464,17 +464,17 @@ Path EvalState::toRealPath(const Path& path, const PathSet& context) {
                                                     : path;
 };
 
-Value* EvalState::addConstant(const string& name, Value& v) {
+Value* EvalState::addConstant(const std::string& name, Value& v) {
   Value* v2 = allocValue();
   *v2 = v;
   staticBaseEnv.vars[symbols.Create(name)] = baseEnvDispl;
   baseEnv.values[baseEnvDispl++] = v2;
-  string name2 = string(name, 0, 2) == "__" ? string(name, 2) : name;
+  std::string name2 = string(name, 0, 2) == "__" ? string(name, 2) : name;
   baseEnv.values[0]->attrs->push_back(Attr(symbols.Create(name2), v2));
   return v2;
 }
 
-Value* EvalState::addPrimOp(const string& name, size_t arity,
+Value* EvalState::addPrimOp(const std::string& name, size_t arity,
                             PrimOpFun primOp) {
   if (arity == 0) {
     Value v;
@@ -482,7 +482,7 @@ Value* EvalState::addPrimOp(const string& name, size_t arity,
     return addConstant(name, v);
   }
   Value* v = allocValue();
-  string name2 = string(name, 0, 2) == "__" ? string(name, 2) : name;
+  std::string name2 = string(name, 0, 2) == "__" ? string(name, 2) : name;
   Symbol sym = symbols.Create(name2);
   v->type = tPrimOp;
   v->primOp = new PrimOp(primOp, arity, sym);
@@ -492,7 +492,7 @@ Value* EvalState::addPrimOp(const string& name, size_t arity,
   return v;
 }
 
-Value& EvalState::getBuiltin(const string& name) {
+Value& EvalState::getBuiltin(const std::string& name) {
   return *baseEnv.values[0]->attrs->find(symbols.Create(name))->value;
 }
 
@@ -501,22 +501,24 @@ Value& EvalState::getBuiltin(const string& name) {
    evaluator.  So here are some helper functions for throwing
    exceptions. */
 
-LocalNoInlineNoReturn(void throwEvalError(const char* s, const string& s2)) {
+LocalNoInlineNoReturn(void throwEvalError(const char* s,
+                                          const std::string& s2)) {
   throw EvalError(format(s) % s2);
 }
 
-LocalNoInlineNoReturn(void throwEvalError(const char* s, const string& s2,
+LocalNoInlineNoReturn(void throwEvalError(const char* s, const std::string& s2,
                                           const Pos& pos)) {
   throw EvalError(format(s) % s2 % pos);
 }
 
-LocalNoInlineNoReturn(void throwEvalError(const char* s, const string& s2,
-                                          const string& s3)) {
+LocalNoInlineNoReturn(void throwEvalError(const char* s, const std::string& s2,
+                                          const std::string& s3)) {
   throw EvalError(format(s) % s2 % s3);
 }
 
-LocalNoInlineNoReturn(void throwEvalError(const char* s, const string& s2,
-                                          const string& s3, const Pos& pos)) {
+LocalNoInlineNoReturn(void throwEvalError(const char* s, const std::string& s2,
+                                          const std::string& s3,
+                                          const Pos& pos)) {
   throw EvalError(format(s) % s2 % s3 % pos);
 }
 
@@ -529,7 +531,8 @@ LocalNoInlineNoReturn(void throwTypeError(const char* s, const Pos& pos)) {
   throw TypeError(format(s) % pos);
 }
 
-LocalNoInlineNoReturn(void throwTypeError(const char* s, const string& s1)) {
+LocalNoInlineNoReturn(void throwTypeError(const char* s,
+                                          const std::string& s1)) {
   throw TypeError(format(s) % s1);
 }
 
@@ -538,18 +541,20 @@ LocalNoInlineNoReturn(void throwTypeError(const char* s, const ExprLambda& fun,
   throw TypeError(format(s) % fun.showNamePos() % s2 % pos);
 }
 
-LocalNoInlineNoReturn(void throwAssertionError(const char* s, const string& s1,
+LocalNoInlineNoReturn(void throwAssertionError(const char* s,
+                                               const std::string& s1,
                                                const Pos& pos)) {
   throw AssertionError(format(s) % s1 % pos);
 }
 
 LocalNoInlineNoReturn(void throwUndefinedVarError(const char* s,
-                                                  const string& s1,
+                                                  const std::string& s1,
                                                   const Pos& pos)) {
   throw UndefinedVarError(format(s) % s1 % pos);
 }
 
-LocalNoInline(void addErrorPrefix(Error& e, const char* s, const string& s2)) {
+LocalNoInline(void addErrorPrefix(Error& e, const char* s,
+                                  const std::string& s2)) {
   e.addPrefix(format(s) % s2);
 }
 
@@ -558,14 +563,14 @@ LocalNoInline(void addErrorPrefix(Error& e, const char* s,
   e.addPrefix(format(s) % fun.showNamePos() % pos);
 }
 
-LocalNoInline(void addErrorPrefix(Error& e, const char* s, const string& s2,
-                                  const Pos& pos)) {
+LocalNoInline(void addErrorPrefix(Error& e, const char* s,
+                                  const std::string& s2, const Pos& pos)) {
   e.addPrefix(format(s) % s2 % pos);
 }
 
 void mkString(Value& v, const char* s) { mkStringNoCopy(v, dupString(s)); }
 
-Value& mkString(Value& v, const string& s, const PathSet& context) {
+Value& mkString(Value& v, const std::string& s, const PathSet& context) {
   mkString(v, s.c_str());
   if (!context.empty()) {
     size_t n = 0;
@@ -931,8 +936,8 @@ void ExprVar::eval(EvalState& state, Env& env, Value& v) {
   v = *v2;
 }
 
-static string showAttrPath(EvalState& state, Env& env,
-                           const AttrPath& attrPath) {
+static std::string showAttrPath(EvalState& state, Env& env,
+                                const AttrPath& attrPath) {
   std::ostringstream out;
   bool first = true;
   for (auto& i : attrPath) {
@@ -1528,13 +1533,13 @@ void copyContext(const Value& v, PathSet& context) {
 }
 
 string EvalState::forceString(Value& v, PathSet& context, const Pos& pos) {
-  string s = forceString(v, pos);
+  std::string s = forceString(v, pos);
   copyContext(v, context);
   return s;
 }
 
 string EvalState::forceStringNoCtx(Value& v, const Pos& pos) {
-  string s = forceString(v, pos);
+  std::string s = forceString(v, pos);
   if (v.string.context != nullptr) {
     if (pos) {
       throwEvalError(
@@ -1584,7 +1589,7 @@ string EvalState::coerceToString(const Pos& pos, Value& v, PathSet& context,
                                  bool coerceMore, bool copyToStore) {
   forceValue(v);
 
-  string s;
+  std::string s;
 
   if (v.type == tString) {
     copyContext(v, context);
@@ -1633,7 +1638,7 @@ string EvalState::coerceToString(const Pos& pos, Value& v, PathSet& context,
     }
 
     if (v.isList()) {
-      string result;
+      std::string result;
       for (size_t n = 0; n < v.listSize(); ++n) {
         result += coerceToString(pos, *v.listElems()[n], context, coerceMore,
                                  copyToStore);
@@ -1677,7 +1682,7 @@ string EvalState::copyPathToStore(PathSet& context, const Path& path) {
 }
 
 Path EvalState::coerceToPath(const Pos& pos, Value& v, PathSet& context) {
-  string path = coerceToString(pos, v, context, false, false);
+  std::string path = coerceToString(pos, v, context, false, false);
   if (path.empty() || path[0] != '/') {
     throwEvalError("string '%1%' doesn't represent an absolute path, at %2%",
                    path, pos);
@@ -1871,12 +1876,12 @@ void EvalState::printStats() {
         for (auto& i : functionCalls) {
           auto obj = list.object();
           if (i.first->name.set()) {
-            obj.attr("name", (const string&)i.first->name);
+            obj.attr("name", (const std::string&)i.first->name);
           } else {
             obj.attr("name", nullptr);
           }
           if (i.first->pos) {
-            obj.attr("file", (const string&)i.first->pos.file);
+            obj.attr("file", (const std::string&)i.first->pos.file);
             obj.attr("line", i.first->pos.line);
             obj.attr("column", i.first->pos.column);
           }
@@ -1888,7 +1893,7 @@ void EvalState::printStats() {
         for (auto& i : attrSelects) {
           auto obj = list.object();
           if (i.first) {
-            obj.attr("file", (const string&)i.first.file);
+            obj.attr("file", (const std::string&)i.first.file);
             obj.attr("line", i.first.line);
             obj.attr("column", i.first.column);
           }
diff --git a/third_party/nix/src/libexpr/eval.hh b/third_party/nix/src/libexpr/eval.hh
index 48400d5f08e2..055c4fda3702 100644
--- a/third_party/nix/src/libexpr/eval.hh
+++ b/third_party/nix/src/libexpr/eval.hh
@@ -36,7 +36,8 @@ struct Env {
   Value* values[0];
 };
 
-Value& mkString(Value& v, const string& s, const PathSet& context = PathSet());
+Value& mkString(Value& v, const std::string& s,
+                const PathSet& context = PathSet());
 
 void copyContext(const Value& v, PathSet& context);
 
@@ -108,7 +109,7 @@ class EvalState {
   EvalState(const Strings& _searchPath, const ref<Store>& store);
   ~EvalState();
 
-  void addToSearchPath(const string& s);
+  void addToSearchPath(const std::string& s);
 
   SearchPath getSearchPath() { return searchPath; }
 
@@ -130,9 +131,9 @@ class EvalState {
   Expr* parseExprFromFile(const Path& path, StaticEnv& staticEnv);
 
   /* Parse a Nix expression from the specified string. */
-  Expr* parseExprFromString(const string& s, const Path& basePath,
+  Expr* parseExprFromString(const std::string& s, const Path& basePath,
                             StaticEnv& staticEnv);
-  Expr* parseExprFromString(const string& s, const Path& basePath);
+  Expr* parseExprFromString(const std::string& s, const Path& basePath);
 
   Expr* parseStdin();
 
@@ -143,8 +144,8 @@ class EvalState {
   void resetFileCache();
 
   /* Look up a file in the search path. */
-  Path findFile(const string& path);
-  Path findFile(SearchPath& searchPath, const string& path,
+  Path findFile(const std::string& path);
+  Path findFile(SearchPath& searchPath, const std::string& path,
                 const Pos& pos = noPos);
 
   /* If the specified search path element is a URI, download it. */
@@ -180,9 +181,9 @@ class EvalState {
   inline void forceList(Value& v);
   inline void forceList(Value& v, const Pos& pos);
   void forceFunction(Value& v, const Pos& pos);  // either lambda or primop
-  string forceString(Value& v, const Pos& pos = noPos);
-  string forceString(Value& v, PathSet& context, const Pos& pos = noPos);
-  string forceStringNoCtx(Value& v, const Pos& pos = noPos);
+  std::string forceString(Value& v, const Pos& pos = noPos);
+  std::string forceString(Value& v, PathSet& context, const Pos& pos = noPos);
+  std::string forceStringNoCtx(Value& v, const Pos& pos = noPos);
 
   /* Return true iff the value `v' denotes a derivation (i.e. a
      set with attribute `type = "derivation"'). */
@@ -197,10 +198,10 @@ class EvalState {
      string.  If `coerceMore' is set, also converts nulls, integers,
      booleans and lists to a string.  If `copyToStore' is set,
      referenced paths are copied to the Nix store as a side effect. */
-  string coerceToString(const Pos& pos, Value& v, PathSet& context,
-                        bool coerceMore = false, bool copyToStore = true);
+  std::string coerceToString(const Pos& pos, Value& v, PathSet& context,
+                             bool coerceMore = false, bool copyToStore = true);
 
-  string copyPathToStore(PathSet& context, const Path& path);
+  std::string copyPathToStore(PathSet& context, const Path& path);
 
   /* Path coercion.  Converts strings, paths and derivations to a
      path.  The result is guaranteed to be a canonicalised, absolute
@@ -220,12 +221,12 @@ class EvalState {
 
   void createBaseEnv();
 
-  Value* addConstant(const string& name, Value& v);
+  Value* addConstant(const std::string& name, Value& v);
 
-  Value* addPrimOp(const string& name, size_t arity, PrimOpFun primOp);
+  Value* addPrimOp(const std::string& name, size_t arity, PrimOpFun primOp);
 
  public:
-  Value& getBuiltin(const string& name);
+  Value& getBuiltin(const std::string& name);
 
  private:
   inline Value* lookupVar(Env* env, const ExprVar& var, bool noEval);
@@ -309,7 +310,7 @@ string showType(const Value& v);
 
 /* Decode a context string ‘!<name>!<path>’ into a pair <path,
    name>. */
-std::pair<string, string> decodeContext(const string& s);
+std::pair<string, string> decodeContext(const std::string& s);
 
 /* If `path' refers to a directory, then append "/default.nix". */
 Path resolveExprPath(Path path);
diff --git a/third_party/nix/src/libexpr/get-drvs.cc b/third_party/nix/src/libexpr/get-drvs.cc
index 4d412a9c619e..733ee5a1ff7c 100644
--- a/third_party/nix/src/libexpr/get-drvs.cc
+++ b/third_party/nix/src/libexpr/get-drvs.cc
@@ -12,7 +12,7 @@
 
 namespace nix {
 
-DrvInfo::DrvInfo(EvalState& state, string attrPath, Bindings* attrs)
+DrvInfo::DrvInfo(EvalState& state, std::string attrPath, Bindings* attrs)
     : state(&state), attrs(attrs), attrPath(std::move(attrPath)) {}
 
 DrvInfo::DrvInfo(EvalState& state, const ref<Store>& store,
@@ -97,7 +97,7 @@ DrvInfo::Outputs DrvInfo::queryOutputs(bool onlyOutputsToInstall) {
       /* For each output... */
       for (unsigned int j = 0; j < i->value->listSize(); ++j) {
         /* Evaluate the corresponding set. */
-        string name =
+        std::string name =
             state->forceStringNoCtx(*i->value->listElems()[j], *i->pos);
         Bindings::iterator out = attrs->find(state->symbols.Create(name));
         if (out == attrs->end()) {
@@ -209,7 +209,7 @@ bool DrvInfo::checkMeta(Value& v) {
   }
 }
 
-Value* DrvInfo::queryMeta(const string& name) {
+Value* DrvInfo::queryMeta(const std::string& name) {
   if (getMeta() == nullptr) {
     return nullptr;
   }
@@ -220,7 +220,7 @@ Value* DrvInfo::queryMeta(const string& name) {
   return a->value;
 }
 
-string DrvInfo::queryMetaString(const string& name) {
+string DrvInfo::queryMetaString(const std::string& name) {
   Value* v = queryMeta(name);
   if ((v == nullptr) || v->type != tString) {
     return "";
@@ -228,7 +228,7 @@ string DrvInfo::queryMetaString(const string& name) {
   return v->string.s;
 }
 
-NixInt DrvInfo::queryMetaInt(const string& name, NixInt def) {
+NixInt DrvInfo::queryMetaInt(const std::string& name, NixInt def) {
   Value* v = queryMeta(name);
   if (v == nullptr) {
     return def;
@@ -247,7 +247,7 @@ NixInt DrvInfo::queryMetaInt(const string& name, NixInt def) {
   return def;
 }
 
-NixFloat DrvInfo::queryMetaFloat(const string& name, NixFloat def) {
+NixFloat DrvInfo::queryMetaFloat(const std::string& name, NixFloat def) {
   Value* v = queryMeta(name);
   if (v == nullptr) {
     return def;
@@ -266,7 +266,7 @@ NixFloat DrvInfo::queryMetaFloat(const string& name, NixFloat def) {
   return def;
 }
 
-bool DrvInfo::queryMetaBool(const string& name, bool def) {
+bool DrvInfo::queryMetaBool(const std::string& name, bool def) {
   Value* v = queryMeta(name);
   if (v == nullptr) {
     return def;
@@ -287,7 +287,7 @@ bool DrvInfo::queryMetaBool(const string& name, bool def) {
   return def;
 }
 
-void DrvInfo::setMeta(const string& name, Value* v) {
+void DrvInfo::setMeta(const std::string& name, Value* v) {
   getMeta();
   Bindings* old = meta;
   meta = state->allocBindings(1 + (old != nullptr ? old->size() : 0));
@@ -312,9 +312,9 @@ using Done = set<Bindings*>;
    then put information about it in `drvs' (unless it's already in `done').
    The result boolean indicates whether it makes sense
    for the caller to recursively search for derivations in `v'. */
-static bool getDerivation(EvalState& state, Value& v, const string& attrPath,
-                          DrvInfos& drvs, Done& done,
-                          bool ignoreAssertionFailures) {
+static bool getDerivation(EvalState& state, Value& v,
+                          const std::string& attrPath, DrvInfos& drvs,
+                          Done& done, bool ignoreAssertionFailures) {
   try {
     state.forceValue(v);
     if (!state.isDerivation(v)) {
@@ -355,14 +355,14 @@ std::optional<DrvInfo> getDerivation(EvalState& state, Value& v,
   return std::move(drvs.front());
 }
 
-static string addToPath(const string& s1, const string& s2) {
+static std::string addToPath(const std::string& s1, const std::string& s2) {
   return s1.empty() ? s2 : s1 + "." + s2;
 }
 
 static std::regex attrRegex("[A-Za-z_][A-Za-z0-9-_+]*");
 
 static void getDerivations(EvalState& state, Value& vIn,
-                           const string& pathPrefix, Bindings& autoArgs,
+                           const std::string& pathPrefix, Bindings& autoArgs,
                            DrvInfos& drvs, Done& done,
                            bool ignoreAssertionFailures) {
   Value v;
@@ -390,7 +390,7 @@ static void getDerivations(EvalState& state, Value& vIn,
       if (!std::regex_match(std::string(i->name), attrRegex)) {
         continue;
       }
-      string pathPrefix2 = addToPath(pathPrefix, i->name);
+      std::string pathPrefix2 = addToPath(pathPrefix, i->name);
       if (combineChannels) {
         getDerivations(state, *i->value, pathPrefix2, autoArgs, drvs, done,
                        ignoreAssertionFailures);
@@ -414,7 +414,8 @@ static void getDerivations(EvalState& state, Value& vIn,
 
   else if (v.isList()) {
     for (unsigned int n = 0; n < v.listSize(); ++n) {
-      string pathPrefix2 = addToPath(pathPrefix, (format("%1%") % n).str());
+      std::string pathPrefix2 =
+          addToPath(pathPrefix, (format("%1%") % n).str());
       if (getDerivation(state, *v.listElems()[n], pathPrefix2, drvs, done,
                         ignoreAssertionFailures)) {
         getDerivations(state, *v.listElems()[n], pathPrefix2, autoArgs, drvs,
@@ -430,7 +431,7 @@ static void getDerivations(EvalState& state, Value& vIn,
   }
 }
 
-void getDerivations(EvalState& state, Value& v, const string& pathPrefix,
+void getDerivations(EvalState& state, Value& v, const std::string& pathPrefix,
                     Bindings& autoArgs, DrvInfos& drvs,
                     bool ignoreAssertionFailures) {
   Done done;
diff --git a/third_party/nix/src/libexpr/get-drvs.hh b/third_party/nix/src/libexpr/get-drvs.hh
index f0de0f67b8da..3da23194616e 100644
--- a/third_party/nix/src/libexpr/get-drvs.hh
+++ b/third_party/nix/src/libexpr/get-drvs.hh
@@ -14,11 +14,11 @@ struct DrvInfo {
  private:
   EvalState* state;
 
-  mutable string name;
-  mutable string system;
-  mutable string drvPath;
-  mutable string outPath;
-  mutable string outputName;
+  mutable std::string name;
+  mutable std::string system;
+  mutable std::string drvPath;
+  mutable std::string outPath;
+  mutable std::string outputName;
   Outputs outputs;
 
   bool failed = false;  // set if we get an AssertionError
@@ -30,38 +30,38 @@ struct DrvInfo {
   bool checkMeta(Value& v);
 
  public:
-  string attrPath; /* path towards the derivation */
+  std::string attrPath; /* path towards the derivation */
 
   DrvInfo(EvalState& state) : state(&state){};
-  DrvInfo(EvalState& state, string attrPath, Bindings* attrs);
+  DrvInfo(EvalState& state, std::string attrPath, Bindings* attrs);
   DrvInfo(EvalState& state, const ref<Store>& store,
           const std::string& drvPathWithOutputs);
 
-  string queryName() const;
-  string querySystem() const;
-  string queryDrvPath() const;
-  string queryOutPath() const;
-  string queryOutputName() const;
+  std::string queryName() const;
+  std::string querySystem() const;
+  std::string queryDrvPath() const;
+  std::string queryOutPath() const;
+  std::string queryOutputName() const;
   /** Return the list of outputs. The "outputs to install" are determined by
    * `meta.outputsToInstall`. */
   Outputs queryOutputs(bool onlyOutputsToInstall = false);
 
   StringSet queryMetaNames();
-  Value* queryMeta(const string& name);
-  string queryMetaString(const string& name);
-  NixInt queryMetaInt(const string& name, NixInt def);
-  NixFloat queryMetaFloat(const string& name, NixFloat def);
-  bool queryMetaBool(const string& name, bool def);
-  void setMeta(const string& name, Value* v);
+  Value* queryMeta(const std::string& name);
+  std::string queryMetaString(const std::string& name);
+  NixInt queryMetaInt(const std::string& name, NixInt def);
+  NixFloat queryMetaFloat(const std::string& name, NixFloat def);
+  bool queryMetaBool(const std::string& name, bool def);
+  void setMeta(const std::string& name, Value* v);
 
   /*
   MetaInfo queryMetaInfo(EvalState & state) const;
-  MetaValue queryMetaInfo(EvalState & state, const string & name) const;
+  MetaValue queryMetaInfo(EvalState & state, const std::string & name) const;
   */
 
-  void setName(const string& s) { name = s; }
-  void setDrvPath(const string& s) { drvPath = s; }
-  void setOutPath(const string& s) { outPath = s; }
+  void setName(const std::string& s) { name = s; }
+  void setDrvPath(const std::string& s) { drvPath = s; }
+  void setOutPath(const std::string& s) { outPath = s; }
 
   void setFailed() { failed = true; };
   bool hasFailed() { return failed; };
@@ -78,7 +78,7 @@ typedef list<DrvInfo> DrvInfos;
 std::optional<DrvInfo> getDerivation(EvalState& state, Value& v,
                                      bool ignoreAssertionFailures);
 
-void getDerivations(EvalState& state, Value& v, const string& pathPrefix,
+void getDerivations(EvalState& state, Value& v, const std::string& pathPrefix,
                     Bindings& autoArgs, DrvInfos& drvs,
                     bool ignoreAssertionFailures);
 
diff --git a/third_party/nix/src/libexpr/json-to-value.cc b/third_party/nix/src/libexpr/json-to-value.cc
index ea7d575aa9e2..17603c59ea2a 100644
--- a/third_party/nix/src/libexpr/json-to-value.cc
+++ b/third_party/nix/src/libexpr/json-to-value.cc
@@ -10,8 +10,8 @@ static void skipWhitespace(const char*& s) {
   }
 }
 
-static string parseJSONString(const char*& s) {
-  string res;
+static std::string parseJSONString(const char*& s) {
+  std::string res;
   if (*s++ != '"') {
     throw JSONParseError("expected JSON string");
   }
@@ -97,7 +97,7 @@ static void parseJSON(EvalState& state, const char*& s, Value& v) {
       if (attrs.empty() && *s == '}') {
         break;
       }
-      string name = parseJSONString(s);
+      std::string name = parseJSONString(s);
       skipWhitespace(s);
       if (*s != ':') {
         throw JSONParseError("expected ':' in JSON object");
@@ -128,7 +128,7 @@ static void parseJSON(EvalState& state, const char*& s, Value& v) {
   }
 
   else if ((isdigit(*s) != 0) || *s == '-' || *s == '.') {
-    // Buffer into a string first, then use built-in C++ conversions
+    // Buffer into a std::string first, then use built-in C++ conversions
     std::string tmp_number;
     ValueType number_type = tInt;
 
@@ -173,7 +173,7 @@ static void parseJSON(EvalState& state, const char*& s, Value& v) {
   }
 }
 
-void parseJSON(EvalState& state, const string& s_, Value& v) {
+void parseJSON(EvalState& state, const std::string& s_, Value& v) {
   const char* s = s_.c_str();
   parseJSON(state, s, v);
   skipWhitespace(s);
diff --git a/third_party/nix/src/libexpr/json-to-value.hh b/third_party/nix/src/libexpr/json-to-value.hh
index 5b67b350646e..f416dfbb3860 100644
--- a/third_party/nix/src/libexpr/json-to-value.hh
+++ b/third_party/nix/src/libexpr/json-to-value.hh
@@ -8,6 +8,6 @@ namespace nix {
 
 MakeError(JSONParseError, EvalError)
 
-    void parseJSON(EvalState& state, const string& s, Value& v);
+    void parseJSON(EvalState& state, const std::string& s, Value& v);
 
 }
diff --git a/third_party/nix/src/libexpr/lexer.l b/third_party/nix/src/libexpr/lexer.l
index 1f9e45a1cdaa..9cdb2bd97ecf 100644
--- a/third_party/nix/src/libexpr/lexer.l
+++ b/third_party/nix/src/libexpr/lexer.l
@@ -53,7 +53,7 @@ static void adjustLoc(YYLTYPE * loc, const char * s, size_t len)
 
 static Expr * unescapeStr(SymbolTable & symbols, const char * s, size_t length)
 {
-    string t;
+    std::string t;
     t.reserve(length);
     char c;
     while ((c = *s++)) {
diff --git a/third_party/nix/src/libexpr/names.cc b/third_party/nix/src/libexpr/names.cc
index f559c13a6115..ac8150532f25 100644
--- a/third_party/nix/src/libexpr/names.cc
+++ b/third_party/nix/src/libexpr/names.cc
@@ -13,7 +13,7 @@ DrvName::DrvName() { name = ""; }
    a letter.  The `version' part is the rest (excluding the separating
    dash).  E.g., `apache-httpd-2.0.48' is parsed to (`apache-httpd',
    '2.0.48'). */
-DrvName::DrvName(const string& s) : hits(0) {
+DrvName::DrvName(const std::string& s) : hits(0) {
   name = fullName = s;
   for (unsigned int i = 0; i < s.size(); ++i) {
     /* !!! isalpha/isdigit are affected by the locale. */
@@ -51,7 +51,7 @@ string nextComponent(string::const_iterator& p,
   /* If the first character is a digit, consume the longest sequence
      of digits.  Otherwise, consume the longest sequence of
      non-digit, non-separator characters. */
-  string s;
+  std::string s;
   if (isdigit(*p) != 0) {
     while (p != end && (isdigit(*p) != 0)) {
       s += *p++;
@@ -65,7 +65,7 @@ string nextComponent(string::const_iterator& p,
   return s;
 }
 
-static bool componentsLT(const string& c1, const string& c2) {
+static bool componentsLT(const std::string& c1, const std::string& c2) {
   int n1;
   int n2;
   bool c1Num = string2Int(c1, n1);
@@ -90,13 +90,13 @@ static bool componentsLT(const string& c1, const string& c2) {
   }
 }
 
-int compareVersions(const string& v1, const string& v2) {
+int compareVersions(const std::string& v1, const std::string& v2) {
   string::const_iterator p1 = v1.begin();
   string::const_iterator p2 = v2.begin();
 
   while (p1 != v1.end() || p2 != v2.end()) {
-    string c1 = nextComponent(p1, v1.end());
-    string c2 = nextComponent(p2, v2.end());
+    std::string c1 = nextComponent(p1, v1.end());
+    std::string c2 = nextComponent(p2, v2.end());
     if (componentsLT(c1, c2)) {
       return -1;
     }
diff --git a/third_party/nix/src/libexpr/names.hh b/third_party/nix/src/libexpr/names.hh
index bd2aa1a11552..e2ddb5cb993e 100644
--- a/third_party/nix/src/libexpr/names.hh
+++ b/third_party/nix/src/libexpr/names.hh
@@ -8,13 +8,13 @@
 namespace nix {
 
 struct DrvName {
-  string fullName;
-  string name;
-  string version;
+  std::string fullName;
+  std::string name;
+  std::string version;
   unsigned int hits;
 
   DrvName();
-  DrvName(const string& s);
+  DrvName(const std::string& s);
   bool matches(DrvName& n);
 
  private:
@@ -25,7 +25,7 @@ typedef list<DrvName> DrvNames;
 
 string nextComponent(string::const_iterator& p,
                      const string::const_iterator end);
-int compareVersions(const string& v1, const string& v2);
+int compareVersions(const std::string& v1, const std::string& v2);
 DrvNames drvNamesFromArgs(const Strings& opArgs);
 
 }  // namespace nix
diff --git a/third_party/nix/src/libexpr/nixexpr.cc b/third_party/nix/src/libexpr/nixexpr.cc
index d7b1a0fdd572..49b4a7ea419b 100644
--- a/third_party/nix/src/libexpr/nixexpr.cc
+++ b/third_party/nix/src/libexpr/nixexpr.cc
@@ -14,7 +14,7 @@ std::ostream& operator<<(std::ostream& str, const Expr& e) {
   return str;
 }
 
-static void showString(std::ostream& str, const string& s) {
+static void showString(std::ostream& str, const std::string& s) {
   str << '"';
   for (auto c : (string)s) {
     if (c == '"' || c == '\\' || c == '$') {
@@ -32,7 +32,7 @@ static void showString(std::ostream& str, const string& s) {
   str << '"';
 }
 
-static void showId(std::ostream& str, const string& s) {
+static void showId(std::ostream& str, const std::string& s) {
   if (s.empty()) {
     str << "\"\"";
   } else if (s == "if") {  // FIXME: handle other keywords
diff --git a/third_party/nix/src/libexpr/nixexpr.hh b/third_party/nix/src/libexpr/nixexpr.hh
index 8817e745b199..715dbd8d59f1 100644
--- a/third_party/nix/src/libexpr/nixexpr.hh
+++ b/third_party/nix/src/libexpr/nixexpr.hh
@@ -3,6 +3,7 @@
 #include <map>
 
 #include "symbol-table.hh"
+#include "types.hh"  // TODO(tazjin): audit this include
 #include "value.hh"
 
 namespace nix {
@@ -111,14 +112,14 @@ struct ExprString : Expr {
 
 /* Temporary class used during parsing of indented strings. */
 struct ExprIndStr : Expr {
-  string s;
-  ExprIndStr(const string& s) : s(s){};
+  std::string s;
+  ExprIndStr(const std::string& s) : s(s){};
 };
 
 struct ExprPath : Expr {
-  string s;
+  std::string s;
   Value v;
-  ExprPath(const string& s) : s(s) { mkPathNoCopy(v, this->s.c_str()); };
+  ExprPath(const std::string& s) : s(s) { mkPathNoCopy(v, this->s.c_str()); };
   COMMON_METHODS
   Value* maybeThunk(EvalState& state, Env& env);
 };
@@ -231,7 +232,7 @@ struct ExprLambda : Expr {
           pos);
   };
   void setName(Symbol& name);
-  string showNamePos() const;
+  std::string showNamePos() const;
   COMMON_METHODS
 };
 
diff --git a/third_party/nix/src/libexpr/parser.y b/third_party/nix/src/libexpr/parser.y
index f5a25d5934c5..bd62a7fd0f52 100644
--- a/third_party/nix/src/libexpr/parser.y
+++ b/third_party/nix/src/libexpr/parser.y
@@ -30,7 +30,7 @@ namespace nix {
         Expr * result;
         Path basePath;
         Symbol path;
-        string error;
+        std::string error;
         Symbol sLetBody;
         ParseData(EvalState & state)
             : state(state)
@@ -199,7 +199,7 @@ static Expr * stripIndentation(const Pos & pos, SymbolTable & symbols, vector<Ex
             continue;
         }
 
-        string s2;
+        std::string s2;
         for (size_t j = 0; j < e->s.size(); ++j) {
             if (atStartOfLine) {
                 if (e->s[j] == ' ') {
@@ -396,7 +396,7 @@ expr_simple
   | PATH { $$ = new ExprPath(absPath($1, data->basePath)); }
   | HPATH { $$ = new ExprPath(getHome() + string{$1 + 1}); }
   | SPATH {
-      string path($1 + 1, strlen($1) - 2);
+      std::string path($1 + 1, strlen($1) - 2);
       $$ = new ExprApp(CUR_POS,
           new ExprApp(new ExprVar(data->symbols.Create("__findFile")),
               new ExprVar(data->symbols.Create("__nixPath"))),
@@ -601,13 +601,13 @@ Expr * EvalState::parseExprFromFile(const Path & path, StaticEnv & staticEnv)
 }
 
 
-Expr * EvalState::parseExprFromString(const string & s, const Path & basePath, StaticEnv & staticEnv)
+Expr * EvalState::parseExprFromString(const std::string & s, const Path & basePath, StaticEnv & staticEnv)
 {
     return parse(s.c_str(), "(string)", basePath, staticEnv);
 }
 
 
-Expr * EvalState::parseExprFromString(const string & s, const Path & basePath)
+Expr * EvalState::parseExprFromString(const std::string & s, const Path & basePath)
 {
     return parseExprFromString(s, basePath, staticBaseEnv);
 }
@@ -620,10 +620,10 @@ Expr * EvalState::parseStdin()
 }
 
 
-void EvalState::addToSearchPath(const string & s)
+void EvalState::addToSearchPath(const std::string & s)
 {
     size_t pos = s.find('=');
-    string prefix;
+    std::string prefix;
     Path path;
     if (pos == string::npos) {
         path = s;
@@ -636,13 +636,13 @@ void EvalState::addToSearchPath(const string & s)
 }
 
 
-Path EvalState::findFile(const string & path)
+Path EvalState::findFile(const std::string & path)
 {
     return findFile(searchPath, path);
 }
 
 
-Path EvalState::findFile(SearchPath & searchPath, const string & path, const Pos & pos)
+Path EvalState::findFile(SearchPath & searchPath, const std::string & path, const Pos & pos)
 {
     for (auto & i : searchPath) {
         std::string suffix;
diff --git a/third_party/nix/src/libexpr/primops.cc b/third_party/nix/src/libexpr/primops.cc
index 50a745624d4e..1cbe5549682e 100644
--- a/third_party/nix/src/libexpr/primops.cc
+++ b/third_party/nix/src/libexpr/primops.cc
@@ -32,7 +32,7 @@ namespace nix {
 
 /* Decode a context string ‘!<name>!<path>’ into a pair <path,
    name>. */
-std::pair<string, string> decodeContext(const string& s) {
+std::pair<string, string> decodeContext(const std::string& s) {
   if (s.at(0) == '!') {
     size_t index = s.find('!', 1);
     return std::pair<string, string>(string(s, index + 1),
@@ -180,7 +180,7 @@ void prim_importNative(EvalState& state, const Pos& pos, Value** args,
 
   path = state.checkSourcePath(path);
 
-  string sym = state.forceStringNoCtx(*args[1], pos);
+  std::string sym = state.forceStringNoCtx(*args[1], pos);
 
   void* handle = dlopen(path.c_str(), RTLD_LAZY | RTLD_LOCAL);
   if (handle == nullptr) {
@@ -252,7 +252,7 @@ void prim_exec(EvalState& state, const Pos& pos, Value** args, Value& v) {
 static void prim_typeOf(EvalState& state, const Pos& pos, Value** args,
                         Value& v) {
   state.forceValue(*args[0]);
-  string t;
+  std::string t;
   switch (args[0]->type) {
     case tInt:
       t = "int";
@@ -461,7 +461,7 @@ static void prim_genericClosure(EvalState& state, const Pos& pos, Value** args,
 static void prim_abort(EvalState& state, const Pos& pos, Value** args,
                        Value& v) {
   PathSet context;
-  string s = state.coerceToString(pos, *args[0], context);
+  std::string s = state.coerceToString(pos, *args[0], context);
   throw Abort(
       format("evaluation aborted with the following error message: '%1%'") % s);
 }
@@ -469,7 +469,7 @@ static void prim_abort(EvalState& state, const Pos& pos, Value** args,
 static void prim_throw(EvalState& state, const Pos& pos, Value** args,
                        Value& v) {
   PathSet context;
-  string s = state.coerceToString(pos, *args[0], context);
+  std::string s = state.coerceToString(pos, *args[0], context);
   throw ThrownError(s);
 }
 
@@ -504,7 +504,7 @@ static void prim_tryEval(EvalState& state, const Pos& pos, Value** args,
 /* Return an environment variable.  Use with care. */
 static void prim_getEnv(EvalState& state, const Pos& pos, Value** args,
                         Value& v) {
-  string name = state.forceStringNoCtx(*args[0], pos);
+  std::string name = state.forceStringNoCtx(*args[0], pos);
   mkString(v, evalSettings.restrictEval || evalSettings.pureEval
                   ? ""
                   : getEnv(name));
@@ -565,7 +565,7 @@ static void prim_derivationStrict(EvalState& state, const Pos& pos,
   if (attr == args[0]->attrs->end()) {
     throw EvalError(format("required attribute 'name' missing, at %1%") % pos);
   }
-  string drvName;
+  std::string drvName;
   Pos& posDrvName(*attr->pos);
   try {
     drvName = state.forceStringNoCtx(*attr->value, pos);
@@ -607,7 +607,7 @@ static void prim_derivationStrict(EvalState& state, const Pos& pos,
     if (i->name == state.sIgnoreNulls) {
       continue;
     }
-    const string& key = i->name;
+    const std::string& key = i->name;
 
     auto handleHashMode = [&](const std::string& s) {
       if (s == "recursive") {
@@ -660,8 +660,8 @@ static void prim_derivationStrict(EvalState& state, const Pos& pos,
       if (i->name == state.sArgs) {
         state.forceList(*i->value, pos);
         for (unsigned int n = 0; n < i->value->listSize(); ++n) {
-          string s = state.coerceToString(posDrvName, *i->value->listElems()[n],
-                                          context, true);
+          std::string s = state.coerceToString(
+              posDrvName, *i->value->listElems()[n], context, true);
           drv.args.push_back(s);
         }
       }
@@ -965,7 +965,8 @@ static void prim_readFile(EvalState& state, const Pos& pos, Value** args,
         format("cannot read '%1%', since path '%2%' is not valid, at %3%") %
         path % e.path % pos);
   }
-  string s = readFile(state.checkSourcePath(state.toRealPath(path, context)));
+  std::string s =
+      readFile(state.checkSourcePath(state.toRealPath(path, context)));
   if (s.find((char)0) != string::npos) {
     throw Error(format("the contents of the file '%1%' cannot be represented "
                        "as a Nix string") %
@@ -986,7 +987,7 @@ static void prim_findFile(EvalState& state, const Pos& pos, Value** args,
     Value& v2(*args[0]->listElems()[n]);
     state.forceAttrs(v2, pos);
 
-    string prefix;
+    std::string prefix;
     Bindings::iterator i = v2.attrs->find(state.symbols.Create("prefix"));
     if (i != v2.attrs->end()) {
       prefix = state.forceStringNoCtx(*i->value, pos);
@@ -998,7 +999,8 @@ static void prim_findFile(EvalState& state, const Pos& pos, Value** args,
     }
 
     PathSet context;
-    string path = state.coerceToString(pos, *i->value, context, false, false);
+    std::string path =
+        state.coerceToString(pos, *i->value, context, false, false);
 
     try {
       state.realiseContext(context);
@@ -1011,7 +1013,7 @@ static void prim_findFile(EvalState& state, const Pos& pos, Value** args,
     searchPath.emplace_back(prefix, path);
   }
 
-  string path = state.forceStringNoCtx(*args[1], pos);
+  std::string path = state.forceStringNoCtx(*args[1], pos);
 
   mkPath(v,
          state.checkSourcePath(state.findFile(searchPath, path, pos)).c_str());
@@ -1020,7 +1022,7 @@ static void prim_findFile(EvalState& state, const Pos& pos, Value** args,
 /* Return the cryptographic hash of a file in base-16. */
 static void prim_hashFile(EvalState& state, const Pos& pos, Value** args,
                           Value& v) {
-  string type = state.forceStringNoCtx(*args[0], pos);
+  std::string type = state.forceStringNoCtx(*args[0], pos);
   HashType ht = parseHashType(type);
   if (ht == htUnknown) {
     throw Error(format("unknown hash type '%1%', at %2%") % type % pos);
@@ -1094,7 +1096,7 @@ static void prim_toJSON(EvalState& state, const Pos& pos, Value** args,
 /* Parse a JSON string to a value. */
 static void prim_fromJSON(EvalState& state, const Pos& pos, Value** args,
                           Value& v) {
-  string s = state.forceStringNoCtx(*args[0], pos);
+  std::string s = state.forceStringNoCtx(*args[0], pos);
   parseJSON(state, s, v);
 }
 
@@ -1103,8 +1105,8 @@ static void prim_fromJSON(EvalState& state, const Pos& pos, Value** args,
 static void prim_toFile(EvalState& state, const Pos& pos, Value** args,
                         Value& v) {
   PathSet context;
-  string name = state.forceStringNoCtx(*args[0], pos);
-  string contents = state.forceString(*args[1], context, pos);
+  std::string name = state.forceStringNoCtx(*args[0], pos);
+  std::string contents = state.forceString(*args[1], context, pos);
 
   PathSet refs;
 
@@ -1129,7 +1131,7 @@ static void prim_toFile(EvalState& state, const Pos& pos, Value** args,
   mkString(v, storePath, {storePath});
 }
 
-static void addPath(EvalState& state, const Pos& pos, const string& name,
+static void addPath(EvalState& state, const Pos& pos, const std::string& name,
                     const Path& path_, Value* filterFun, bool recursive,
                     const Hash& expectedHash, Value& v) {
   const auto path = evalSettings.pureEval && expectedHash
@@ -1211,13 +1213,13 @@ static void prim_path(EvalState& state, const Pos& pos, Value** args,
                       Value& v) {
   state.forceAttrs(*args[0], pos);
   Path path;
-  string name;
+  std::string name;
   Value* filterFun = nullptr;
   auto recursive = true;
   Hash expectedHash;
 
   for (auto& attr : *args[0]->attrs) {
-    const string& n(attr.name);
+    const std::string& n(attr.name);
     if (n == "path") {
       PathSet context;
       path = state.coerceToPath(*attr.pos, *attr.value, context);
@@ -1298,7 +1300,7 @@ static void prim_attrValues(EvalState& state, const Pos& pos, Value** args,
 
 /* Dynamic version of the `.' operator. */
 void prim_getAttr(EvalState& state, const Pos& pos, Value** args, Value& v) {
-  string attr = state.forceStringNoCtx(*args[0], pos);
+  std::string attr = state.forceStringNoCtx(*args[0], pos);
   state.forceAttrs(*args[1], pos);
   // !!! Should we create a symbol here or just do a lookup?
   Bindings::iterator i = args[1]->attrs->find(state.symbols.Create(attr));
@@ -1316,7 +1318,7 @@ void prim_getAttr(EvalState& state, const Pos& pos, Value** args, Value& v) {
 /* Return position information of the specified attribute. */
 void prim_unsafeGetAttrPos(EvalState& state, const Pos& pos, Value** args,
                            Value& v) {
-  string attr = state.forceStringNoCtx(*args[0], pos);
+  std::string attr = state.forceStringNoCtx(*args[0], pos);
   state.forceAttrs(*args[1], pos);
   Bindings::iterator i = args[1]->attrs->find(state.symbols.Create(attr));
   if (i == args[1]->attrs->end()) {
@@ -1329,7 +1331,7 @@ void prim_unsafeGetAttrPos(EvalState& state, const Pos& pos, Value** args,
 /* Dynamic version of the `?' operator. */
 static void prim_hasAttr(EvalState& state, const Pos& pos, Value** args,
                          Value& v) {
-  string attr = state.forceStringNoCtx(*args[0], pos);
+  std::string attr = state.forceStringNoCtx(*args[0], pos);
   state.forceAttrs(*args[1], pos);
   mkBool(v, args[1]->attrs->find(state.symbols.Create(attr)) !=
                 args[1]->attrs->end());
@@ -1389,7 +1391,7 @@ static void prim_listToAttrs(EvalState& state, const Pos& pos, Value** args,
               "'name' attribute missing in a call to 'listToAttrs', at %1%") %
           pos);
     }
-    string name = state.forceStringNoCtx(*j->value, pos);
+    std::string name = state.forceStringNoCtx(*j->value, pos);
 
     Symbol sym = state.symbols.Create(name);
     if (seen.find(sym) == seen.end()) {
@@ -1896,7 +1898,7 @@ static void prim_lessThan(EvalState& state, const Pos& pos, Value** args,
 static void prim_toString(EvalState& state, const Pos& pos, Value** args,
                           Value& v) {
   PathSet context;
-  string s = state.coerceToString(pos, *args[0], context, true, false);
+  std::string s = state.coerceToString(pos, *args[0], context, true, false);
   mkString(v, s, context);
 }
 
@@ -1909,7 +1911,7 @@ static void prim_substring(EvalState& state, const Pos& pos, Value** args,
   int start = state.forceInt(*args[0], pos);
   int len = state.forceInt(*args[1], pos);
   PathSet context;
-  string s = state.coerceToString(pos, *args[2], context);
+  std::string s = state.coerceToString(pos, *args[2], context);
 
   if (start < 0) {
     throw EvalError(format("negative start position in 'substring', at %1%") %
@@ -1923,21 +1925,21 @@ static void prim_substring(EvalState& state, const Pos& pos, Value** args,
 static void prim_stringLength(EvalState& state, const Pos& pos, Value** args,
                               Value& v) {
   PathSet context;
-  string s = state.coerceToString(pos, *args[0], context);
+  std::string s = state.coerceToString(pos, *args[0], context);
   mkInt(v, s.size());
 }
 
 /* Return the cryptographic hash of a string in base-16. */
 static void prim_hashString(EvalState& state, const Pos& pos, Value** args,
                             Value& v) {
-  string type = state.forceStringNoCtx(*args[0], pos);
+  std::string type = state.forceStringNoCtx(*args[0], pos);
   HashType ht = parseHashType(type);
   if (ht == htUnknown) {
     throw Error(format("unknown hash type '%1%', at %2%") % type % pos);
   }
 
   PathSet context;  // discarded
-  string s = state.forceString(*args[1], context, pos);
+  std::string s = state.forceString(*args[1], context, pos);
 
   mkString(v, hashString(ht, s).to_string(Base16, false), context);
 }
@@ -1982,7 +1984,7 @@ static void prim_match(EvalState& state, const Pos& pos, Value** args,
   }
 }
 
-/* Split a string with a regular expression, and return a list of the
+/* Split a std::string with a regular expression, and return a list of the
    non-matching parts interleaved by the lists of the matching groups. */
 static void prim_split(EvalState& state, const Pos& pos, Value** args,
                        Value& v) {
@@ -2056,7 +2058,7 @@ static void prim_concatStringSep(EvalState& state, const Pos& pos, Value** args,
   auto sep = state.forceString(*args[0], context, pos);
   state.forceList(*args[1], pos);
 
-  string res;
+  std::string res;
   res.reserve((args[1]->listSize() + 32) * sep.size());
   bool first = true;
 
@@ -2100,7 +2102,7 @@ static void prim_replaceStrings(EvalState& state, const Pos& pos, Value** args,
   PathSet context;
   auto s = state.forceString(*args[2], context, pos);
 
-  string res;
+  std::string res;
   // Loops one past last character to handle the case where 'from' contains an
   // empty string.
   for (size_t p = 0; p <= s.size();) {
@@ -2143,7 +2145,7 @@ static void prim_replaceStrings(EvalState& state, const Pos& pos, Value** args,
 
 static void prim_parseDrvName(EvalState& state, const Pos& pos, Value** args,
                               Value& v) {
-  string name = state.forceStringNoCtx(*args[0], pos);
+  std::string name = state.forceStringNoCtx(*args[0], pos);
   DrvName parsed(name);
   state.mkAttrs(v, 2);
   mkString(*state.allocAttr(v, state.sName), parsed.name);
@@ -2154,14 +2156,14 @@ static void prim_parseDrvName(EvalState& state, const Pos& pos, Value** args,
 
 static void prim_compareVersions(EvalState& state, const Pos& pos, Value** args,
                                  Value& v) {
-  string version1 = state.forceStringNoCtx(*args[0], pos);
-  string version2 = state.forceStringNoCtx(*args[1], pos);
+  std::string version1 = state.forceStringNoCtx(*args[0], pos);
+  std::string version2 = state.forceStringNoCtx(*args[1], pos);
   mkInt(v, compareVersions(version1, version2));
 }
 
 static void prim_splitVersion(EvalState& state, const Pos& pos, Value** args,
                               Value& v) {
-  string version = state.forceStringNoCtx(*args[0], pos);
+  std::string version = state.forceStringNoCtx(*args[0], pos);
   auto iter = version.cbegin();
   Strings components;
   while (iter != version.cend()) {
@@ -2184,7 +2186,8 @@ static void prim_splitVersion(EvalState& state, const Pos& pos, Value** args,
  *************************************************************/
 
 void fetch(EvalState& state, const Pos& pos, Value** args, Value& v,
-           const string& who, bool unpack, const std::string& defaultName) {
+           const std::string& who, bool unpack,
+           const std::string& defaultName) {
   CachedDownloadRequest request("");
   request.unpack = unpack;
   request.name = defaultName;
@@ -2195,7 +2198,7 @@ void fetch(EvalState& state, const Pos& pos, Value** args, Value& v,
     state.forceAttrs(*args[0], pos);
 
     for (auto& attr : *args[0]->attrs) {
-      string n(attr.name);
+      std::string n(attr.name);
       if (n == "url") {
         request.uri = state.forceStringNoCtx(*attr.value, *attr.pos);
       } else if (n == "sha256") {
@@ -2431,7 +2434,7 @@ void EvalState::createBaseEnv() {
 
   /* Add a wrapper around the derivation primop that computes the
      `drvPath' and `outPath' attributes lazily. */
-  string path =
+  std::string path =
       canonPath(settings.nixDataDir + "/nix/corepkgs/derivation.nix", true);
   sDerivationNix = symbols.Create(path);
   evalFile(path, v);
diff --git a/third_party/nix/src/libexpr/primops/context.cc b/third_party/nix/src/libexpr/primops/context.cc
index 7fa33bd87fb2..efc94d91ced8 100644
--- a/third_party/nix/src/libexpr/primops/context.cc
+++ b/third_party/nix/src/libexpr/primops/context.cc
@@ -7,7 +7,7 @@ namespace nix {
 static void prim_unsafeDiscardStringContext(EvalState& state, const Pos& pos,
                                             Value** args, Value& v) {
   PathSet context;
-  string s = state.coerceToString(pos, *args[0], context);
+  std::string s = state.coerceToString(pos, *args[0], context);
   mkString(v, s, PathSet());
 }
 
@@ -32,7 +32,7 @@ static RegisterPrimOp r2("__hasContext", 1, prim_hasContext);
 static void prim_unsafeDiscardOutputDependency(EvalState& state, const Pos& pos,
                                                Value** args, Value& v) {
   PathSet context;
-  string s = state.coerceToString(pos, *args[0], context);
+  std::string s = state.coerceToString(pos, *args[0], context);
 
   PathSet context2;
   for (auto& p : context) {
@@ -76,7 +76,7 @@ static void prim_getContext(EvalState& state, const Pos& pos, Value** args,
   auto contextInfos = std::map<Path, ContextInfo>();
   for (const auto& p : context) {
     Path drv;
-    string output;
+    std::string output;
     const Path* path = &p;
     if (p.at(0) == '=') {
       drv = string(p, 1);
diff --git a/third_party/nix/src/libexpr/primops/fetchGit.cc b/third_party/nix/src/libexpr/primops/fetchGit.cc
index 374f075a9170..7ef3dea8eef6 100644
--- a/third_party/nix/src/libexpr/primops/fetchGit.cc
+++ b/third_party/nix/src/libexpr/primops/fetchGit.cc
@@ -215,7 +215,7 @@ static void prim_fetchGit(EvalState& state, const Pos& pos, Value** args,
     state.forceAttrs(*args[0], pos);
 
     for (auto& attr : *args[0]->attrs) {
-      string n(attr.name);
+      std::string n(attr.name);
       if (n == "url")
         url =
             state.coerceToString(*attr.pos, *attr.value, context, false, false);
diff --git a/third_party/nix/src/libexpr/primops/fetchMercurial.cc b/third_party/nix/src/libexpr/primops/fetchMercurial.cc
index 67ecf4f498a5..4205442c732b 100644
--- a/third_party/nix/src/libexpr/primops/fetchMercurial.cc
+++ b/third_party/nix/src/libexpr/primops/fetchMercurial.cc
@@ -102,7 +102,7 @@ HgInfo exportMercurial(ref<Store> store, const std::string& uri,
         try {
           runProgram("hg", true, {"pull", "-R", cacheDir, "--", uri});
         } catch (ExecError& e) {
-          string transJournal = cacheDir + "/.hg/store/journal";
+          std::string transJournal = cacheDir + "/.hg/store/journal";
           /* hg throws "abandoned transaction" error only if this file exists */
           if (pathExists(transJournal)) {
             runProgram("hg", true, {"recover", "-R", cacheDir});
@@ -191,7 +191,7 @@ static void prim_fetchMercurial(EvalState& state, const Pos& pos, Value** args,
     state.forceAttrs(*args[0], pos);
 
     for (auto& attr : *args[0]->attrs) {
-      string n(attr.name);
+      std::string n(attr.name);
       if (n == "url")
         url =
             state.coerceToString(*attr.pos, *attr.value, context, false, false);
diff --git a/third_party/nix/src/libexpr/symbol-table.cc b/third_party/nix/src/libexpr/symbol-table.cc
index 5b9fb27d59aa..6abaedc5173c 100644
--- a/third_party/nix/src/libexpr/symbol-table.cc
+++ b/third_party/nix/src/libexpr/symbol-table.cc
@@ -7,7 +7,7 @@ namespace nix {
 
 Symbol SymbolTable::Create(absl::string_view sym) {
   auto it = symbols_.emplace(sym);
-  const string* ptr = &(*it.first);
+  const std::string* ptr = &(*it.first);
   return Symbol(ptr);
 }
 
diff --git a/third_party/nix/src/libexpr/symbol-table.hh b/third_party/nix/src/libexpr/symbol-table.hh
index 5005bb416bb7..df696c9e1ac8 100644
--- a/third_party/nix/src/libexpr/symbol-table.hh
+++ b/third_party/nix/src/libexpr/symbol-table.hh
@@ -3,11 +3,9 @@
 #include <absl/container/node_hash_set.h>
 #include <absl/strings/string_view.h>
 
-#include "types.hh"
-
 namespace nix {  // TODO(tazjin): ::expr
 
- // TODO(tazjin): Replace with a simpler struct, or get rid of.
+// TODO(tazjin): Replace with a simpler struct, or get rid of.
 class Symbol {
  private:
   const std::string* s;  // pointer into SymbolTable
diff --git a/third_party/nix/src/libexpr/value-to-xml.cc b/third_party/nix/src/libexpr/value-to-xml.cc
index 160c6eba3313..d2b5c66f1f5f 100644
--- a/third_party/nix/src/libexpr/value-to-xml.cc
+++ b/third_party/nix/src/libexpr/value-to-xml.cc
@@ -8,7 +8,8 @@
 
 namespace nix {
 
-static XMLAttrs singletonAttrs(const string& name, const string& value) {
+static XMLAttrs singletonAttrs(const std::string& name,
+                               const std::string& value) {
   XMLAttrs attrs;
   attrs[name] = value;
   return attrs;
diff --git a/third_party/nix/src/libexpr/value.hh b/third_party/nix/src/libexpr/value.hh
index 1f41cf04bb30..892c11220e42 100644
--- a/third_party/nix/src/libexpr/value.hh
+++ b/third_party/nix/src/libexpr/value.hh
@@ -1,6 +1,7 @@
 #pragma once
 
 #include "symbol-table.hh"
+#include "types.hh"
 
 #if HAVE_BOEHMGC
 #include <gc/gc_allocator.h>
@@ -56,10 +57,10 @@ class ExternalValueBase {
 
  public:
   /* Return a simple string describing the type */
-  virtual string showType() const = 0;
+  virtual std::string showType() const = 0;
 
   /* Return a string to be used in builtins.typeOf */
-  virtual string typeOf() const = 0;
+  virtual std::string typeOf() const = 0;
 
   /* How much space does this value take up */
   virtual size_t valueSize(std::set<const void*>& seen) const = 0;
@@ -67,8 +68,8 @@ class ExternalValueBase {
   /* Coerce the value to a string. Defaults to uncoercable, i.e. throws an
    * error
    */
-  virtual string coerceToString(const Pos& pos, PathSet& context, bool copyMore,
-                                bool copyToStore) const;
+  virtual std::string coerceToString(const Pos& pos, PathSet& context,
+                                     bool copyMore, bool copyToStore) const;
 
   /* Compare to another value of the same type. Defaults to uncomparable,
    * i.e. always false.
@@ -225,7 +226,7 @@ static inline void mkStringNoCopy(Value& v, const char* s) {
 }
 
 static inline void mkString(Value& v, const Symbol& s) {
-  mkStringNoCopy(v, ((const string&)s).c_str());
+  mkStringNoCopy(v, ((const std::string&)s).c_str());
 }
 
 void mkString(Value& v, const char* s);