about summary refs log tree commit diff
path: root/third_party/nix
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-19T03·52+0100
committerVincent Ambo <tazjin@google.com>2020-05-19T03·52+0100
commit95a57f15ca795eb1b36363b7d6db6b88bfe444e2 (patch)
treead9328cded554eb7d3e153075c6750a17ca39803 /third_party/nix
parent9aa2ecd78cc865f69a9e978ae55ab0f3eda73c46 (diff)
refactor(3p/nix/nix-*): Replace logging with glog in binaries r/762
Diffstat (limited to 'third_party/nix')
-rw-r--r--third_party/nix/src/build-remote/build-remote.cc32
-rw-r--r--third_party/nix/src/nix-build/nix-build.cc4
-rw-r--r--third_party/nix/src/nix-collect-garbage/nix-collect-garbage.cc3
-rw-r--r--third_party/nix/src/nix-copy-closure/nix-copy-closure.cc11
-rw-r--r--third_party/nix/src/nix-env/nix-env.cc62
-rw-r--r--third_party/nix/src/nix-env/user-env.cc14
-rw-r--r--third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc16
-rw-r--r--third_party/nix/src/nix-store/nix-store.cc14
-rw-r--r--third_party/nix/src/nix/edit.cc6
-rw-r--r--third_party/nix/src/nix/eval.cc3
-rw-r--r--third_party/nix/src/nix/installables.cc6
-rw-r--r--third_party/nix/src/nix/log.cc7
-rw-r--r--third_party/nix/src/nix/main.cc11
-rw-r--r--third_party/nix/src/nix/meson.build2
-rw-r--r--third_party/nix/src/nix/repl.cc12
-rw-r--r--third_party/nix/src/nix/run.cc3
-rw-r--r--third_party/nix/src/nix/search.cc7
-rw-r--r--third_party/nix/src/nix/sigs.cc5
-rw-r--r--third_party/nix/src/nix/upgrade-nix.cc32
-rw-r--r--third_party/nix/src/nix/verify.cc30
-rw-r--r--third_party/nix/src/nix/why-depends.cc8
21 files changed, 120 insertions, 168 deletions
diff --git a/third_party/nix/src/build-remote/build-remote.cc b/third_party/nix/src/build-remote/build-remote.cc
index 42a93bae8a0d..b1558447d66e 100644
--- a/third_party/nix/src/build-remote/build-remote.cc
+++ b/third_party/nix/src/build-remote/build-remote.cc
@@ -1,3 +1,4 @@
+#include <glog/logging.h>
 #include <algorithm>
 #include <cstdlib>
 #include <cstring>
@@ -44,16 +45,12 @@ static bool allSupportedLocally(const std::set<std::string>& requiredFeatures) {
 
 static int _main(int argc, char** argv) {
   {
-    logger = makeJSONLogger(*logger);
-
     /* Ensure we don't get any SSH passphrase or host key popups. */
     unsetenv("DISPLAY");
     unsetenv("SSH_ASKPASS");
 
     if (argc != 2) throw UsageError("called without required arguments");
 
-    verbosity = (Verbosity)std::stoll(argv[1]);
-
     FdSource source(STDIN_FILENO);
 
     /* Read the parent's settings. */
@@ -77,7 +74,7 @@ static int _main(int argc, char** argv) {
     AutoCloseFD bestSlotLock;
 
     auto machines = getMachines();
-    debug("got %d remote builders", machines.size());
+    DLOG(INFO) << "got " << machines.size() << " remote builders";
 
     if (machines.empty()) {
       std::cerr << "# decline-permanently\n";
@@ -119,7 +116,8 @@ static int _main(int argc, char** argv) {
         Machine* bestMachine = nullptr;
         unsigned long long bestLoad = 0;
         for (auto& m : machines) {
-          debug("considering building on remote machine '%s'", m.storeUri);
+          DLOG(INFO) << "considering building on remote machine '" << m.storeUri
+                     << "'";
 
           if (m.enabled &&
               std::find(m.systemTypes.begin(), m.systemTypes.end(),
@@ -183,8 +181,7 @@ static int _main(int argc, char** argv) {
         lock = -1;
 
         try {
-          Activity act(*logger, lvlTalkative, actUnknown,
-                       fmt("connecting to '%s'", bestMachine->storeUri));
+          DLOG(INFO) << "connecting to '" << bestMachine->storeUri << "'";
 
           Store::Params storeParams;
           if (hasPrefix(bestMachine->storeUri, "ssh://")) {
@@ -200,8 +197,8 @@ static int _main(int argc, char** argv) {
 
         } catch (std::exception& e) {
           auto msg = chomp(drainFD(5, false));
-          printError("cannot build on '%s': %s%s", bestMachine->storeUri,
-                     e.what(), (msg.empty() ? "" : ": " + msg));
+          LOG(ERROR) << "cannot build on '" << bestMachine->storeUri
+                     << "': " << e.what() << (msg.empty() ? "" : ": " + msg);
           bestMachine->enabled = false;
           continue;
         }
@@ -222,14 +219,13 @@ static int _main(int argc, char** argv) {
         currentLoad + "/" + escapeUri(storeUri) + ".upload-lock", true);
 
     {
-      Activity act(*logger, lvlTalkative, actUnknown,
-                   fmt("waiting for the upload lock to '%s'", storeUri));
+      DLOG(INFO) << "waiting for the upload lock to '" << storeUri << "'";
 
       auto old = signal(SIGALRM, handleAlarm);
       alarm(15 * 60);
-      if (!lockFile(uploadLock.get(), ltWrite, true))
-        printError(
-            "somebody is hogging the upload lock for '%s', continuing...");
+      if (!lockFile(uploadLock.get(), ltWrite, true)) {
+        LOG(ERROR) << "somebody is hogging the upload lock, continuing...";
+      }
       alarm(0);
       signal(SIGALRM, old);
     }
@@ -238,8 +234,7 @@ static int _main(int argc, char** argv) {
         settings.buildersUseSubstitutes ? Substitute : NoSubstitute;
 
     {
-      Activity act(*logger, lvlTalkative, actUnknown,
-                   fmt("copying dependencies to '%s'", storeUri));
+      DLOG(INFO) << "copying dependencies to '" << storeUri << "'";
       copyPaths(store, ref<Store>(sshStore), inputs, NoRepair, NoCheckSigs,
                 substitute);
     }
@@ -261,8 +256,7 @@ static int _main(int argc, char** argv) {
       if (!store->isValidPath(path)) missing.insert(path);
 
     if (!missing.empty()) {
-      Activity act(*logger, lvlTalkative, actUnknown,
-                   fmt("copying outputs from '%s'", storeUri));
+      DLOG(INFO) << "copying outputs from '" << storeUri << "'";
       store->locksHeld.insert(missing.begin(), missing.end()); /* FIXME: ugly */
       copyPaths(ref<Store>(sshStore), store, missing, NoRepair, NoCheckSigs,
                 NoSubstitute);
diff --git a/third_party/nix/src/nix-build/nix-build.cc b/third_party/nix/src/nix-build/nix-build.cc
index 3cd78d940919..0e6a5631f951 100644
--- a/third_party/nix/src/nix-build/nix-build.cc
+++ b/third_party/nix/src/nix-build/nix-build.cc
@@ -1,3 +1,4 @@
+#include <glog/logging.h>
 #include <cstring>
 #include <fstream>
 #include <iostream>
@@ -359,8 +360,7 @@ static void _main(int argc, char** argv) {
         shell = drv->queryOutPath() + "/bin/bash";
 
       } catch (Error& e) {
-        printError("warning: %s; will use bash from your environment",
-                   e.what());
+        LOG(WARNING) << e.what() << "; will use bash from your environment";
         shell = "bash";
       }
     }
diff --git a/third_party/nix/src/nix-collect-garbage/nix-collect-garbage.cc b/third_party/nix/src/nix-collect-garbage/nix-collect-garbage.cc
index 9c65b0877375..6c78c1d2709a 100644
--- a/third_party/nix/src/nix-collect-garbage/nix-collect-garbage.cc
+++ b/third_party/nix/src/nix-collect-garbage/nix-collect-garbage.cc
@@ -1,3 +1,4 @@
+#include <glog/logging.h>
 #include <cerrno>
 #include <iostream>
 #include "globals.hh"
@@ -34,7 +35,7 @@ void removeOldGenerations(std::string dir) {
         if (e.errNo == ENOENT) continue;
       }
       if (link.find("link") != string::npos) {
-        printInfo(format("removing old generations of profile %1%") % path);
+        LOG(INFO) << "removing old generations of profile " << path;
         if (deleteOlderThan != "")
           deleteGenerationsOlderThan(path, deleteOlderThan, dryRun);
         else
diff --git a/third_party/nix/src/nix-copy-closure/nix-copy-closure.cc b/third_party/nix/src/nix-copy-closure/nix-copy-closure.cc
index 3cc29ae337ff..e4ae1bb35ad6 100644
--- a/third_party/nix/src/nix-copy-closure/nix-copy-closure.cc
+++ b/third_party/nix/src/nix-copy-closure/nix-copy-closure.cc
@@ -1,3 +1,4 @@
+#include <glog/logging.h>
 #include "legacy.hh"
 #include "shared.hh"
 #include "store-api.hh"
@@ -21,10 +22,10 @@ static int _main(int argc, char** argv) {
           else if (*arg == "--version")
             printVersion("nix-copy-closure");
           else if (*arg == "--gzip" || *arg == "--bzip2" || *arg == "--xz") {
-            if (*arg != "--gzip")
-              printMsg(lvlError, format("Warning: '%1%' is not implemented, "
-                                        "falling back to gzip") %
-                                     *arg);
+            if (*arg != "--gzip") {
+              LOG(WARNING) << "'" << *arg
+                           << "' is not implemented, falling back to gzip";
+            }
             gzip = true;
           } else if (*arg == "--from")
             toMode = false;
@@ -33,7 +34,7 @@ static int _main(int argc, char** argv) {
           else if (*arg == "--include-outputs")
             includeOutputs = true;
           else if (*arg == "--show-progress")
-            printMsg(lvlError, "Warning: '--show-progress' is not implemented");
+            LOG(WARNING) << "'--show-progress' is not implemented";
           else if (*arg == "--dry-run")
             dryRun = true;
           else if (*arg == "--use-substitutes" || *arg == "-s")
diff --git a/third_party/nix/src/nix-env/nix-env.cc b/third_party/nix/src/nix-env/nix-env.cc
index f9a441e8e30b..b89003bec648 100644
--- a/third_party/nix/src/nix-env/nix-env.cc
+++ b/third_party/nix/src/nix-env/nix-env.cc
@@ -1,3 +1,4 @@
+#include <glog/logging.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -108,9 +109,8 @@ static void getAllExprs(EvalState& state, const Path& path, StringSet& attrs,
       if (hasSuffix(attrName, ".nix"))
         attrName = string(attrName, 0, attrName.size() - 4);
       if (attrs.find(attrName) != attrs.end()) {
-        printError(format("warning: name collision in input Nix expressions, "
-                          "skipping '%1%'") %
-                   path2);
+        LOG(WARNING) << "name collision in input Nix expressions, skipping '"
+                     << path2 << "'";
         continue;
       }
       attrs.insert(attrName);
@@ -264,10 +264,9 @@ static DrvInfos filterBySelector(EvalState& state, const DrvInfos& allElems,
       matches.clear();
       for (auto& j : newest) {
         if (multiple.find(j.second.first.queryName()) != multiple.end())
-          printInfo(
-              "warning: there are multiple derivations named '%1%'; using the "
-              "first one",
-              j.second.first.queryName());
+          LOG(WARNING) << "warning: there are multiple derivations named '"
+                       << j.second.first.queryName()
+                       << "'; using the first one";
         matches.push_back(j.second);
       }
     }
@@ -401,7 +400,7 @@ static bool keep(DrvInfo& drv) { return drv.queryMetaBool("keep", false); }
 
 static void installDerivations(Globals& globals, const Strings& args,
                                const Path& profile) {
-  debug(format("installing derivations"));
+  DLOG(INFO) << "installing derivations";
 
   /* Get the set of user environment elements to be installed. */
   DrvInfos newElems, newElemsTmp;
@@ -436,12 +435,14 @@ static void installDerivations(Globals& globals, const Strings& args,
         DrvName drvName(i.queryName());
         if (!globals.preserveInstalled &&
             newNames.find(drvName.name) != newNames.end() && !keep(i))
-          printInfo("replacing old '%s'", i.queryName());
+          LOG(INFO) << "replacing old '" << i.queryName() << "'";
         else
           allElems.push_back(i);
       }
 
-      for (auto& i : newElems) printInfo("installing '%s'", i.queryName());
+      for (auto& i : newElems) {
+        LOG(INFO) << "installing " << i.queryName();
+      }
     }
 
     printMissing(*globals.state, newElems);
@@ -474,7 +475,7 @@ typedef enum { utLt, utLeq, utEq, utAlways } UpgradeType;
 
 static void upgradeDerivations(Globals& globals, const Strings& args,
                                UpgradeType upgradeType) {
-  debug(format("upgrading derivations"));
+  DLOG(INFO) << "upgrading derivations";
 
   /* Upgrade works as follows: we take all currently installed
      derivations, and for any derivation matching any selector, look
@@ -539,8 +540,8 @@ static void upgradeDerivations(Globals& globals, const Strings& args,
               compareVersions(drvName.version, bestVersion) <= 0
                   ? "upgrading"
                   : "downgrading";
-          printInfo("%1% '%2%' to '%3%'", action, i.queryName(),
-                    bestElem->queryName());
+          LOG(INFO) << action << " '" << i.queryName() << "' to '"
+                    << bestElem->queryName() << "'";
           newElems.push_back(*bestElem);
         } else
           newElems.push_back(i);
@@ -611,7 +612,7 @@ static void opSetFlag(Globals& globals, Strings opFlags, Strings opArgs) {
       DrvName drvName(i.queryName());
       for (auto& j : selectors)
         if (j.matches(drvName)) {
-          printInfo("setting flag on '%1%'", i.queryName());
+          LOG(INFO) << "setting flag on '" << i.queryName() << "'";
           j.hits++;
           setMetaFlag(*globals.state, i, flagName, flagValue);
           break;
@@ -660,7 +661,7 @@ static void opSet(Globals& globals, Strings opFlags, Strings opArgs) {
     globals.state->store->ensurePath(drv.queryOutPath());
   }
 
-  debug(format("switching to new user environment"));
+  DLOG(INFO) << "switching to new user environment";
   Path generation = createGeneration(ref<LocalFSStore>(store2), globals.profile,
                                      drv.queryOutPath());
   switchLink(globals.profile, generation);
@@ -684,7 +685,7 @@ static void uninstallDerivations(Globals& globals, Strings& selectors,
              i.queryOutPath() ==
                  globals.state->store->followLinksToStorePath(j)) ||
             DrvName(j).matches(drvName)) {
-          printInfo("uninstalling '%s'", i.queryName());
+          LOG(INFO) << "uninstalling '" << i.queryName() << "'";
           found = true;
           break;
         }
@@ -799,8 +800,8 @@ static void queryJSON(Globals& globals, vector<DrvInfo>& elems) {
       auto placeholder = metaObj.placeholder(j);
       Value* v = i.queryMeta(j);
       if (!v) {
-        printError("derivation '%s' has invalid meta attribute '%s'",
-                   i.queryName(), j);
+        LOG(ERROR) << "derivation '" << i.queryName()
+                   << "' has invalid meta attribute '" << j << "'";
         placeholder.write(nullptr);
       } else {
         PathSet context;
@@ -902,10 +903,8 @@ static void opQuery(Globals& globals, Strings opFlags, Strings opArgs) {
     for (auto& i : elems) try {
         paths.insert(i.queryOutPath());
       } catch (AssertionError& e) {
-        printMsg(
-            lvlTalkative,
-            "skipping derivation named '%s' which gives an assertion failure",
-            i.queryName());
+        DLOG(WARNING) << "skipping derivation named '" << i.queryName()
+                      << "' which gives an assertion failure";
         i.setFailed();
       }
     validPaths = globals.state->store->queryValidPaths(paths);
@@ -1065,10 +1064,10 @@ static void opQuery(Globals& globals, Strings opFlags, Strings opArgs) {
               XMLAttrs attrs2;
               attrs2["name"] = j;
               Value* v = i.queryMeta(j);
-              if (!v)
-                printError("derivation '%s' has invalid meta attribute '%s'",
-                           i.queryName(), j);
-              else {
+              if (!v) {
+                LOG(ERROR) << "derivation '" << i.queryName()
+                           << "' has invalid meta attribute '" << j << "'";
+              } else {
                 if (v->type == tString) {
                   attrs2["type"] = "string";
                   attrs2["value"] = v->string.s;
@@ -1118,10 +1117,8 @@ static void opQuery(Globals& globals, Strings opFlags, Strings opArgs) {
       cout.flush();
 
     } catch (AssertionError& e) {
-      printMsg(
-          lvlTalkative,
-          "skipping derivation named '%1%' which gives an assertion failure",
-          i.queryName());
+      DLOG(WARNING) << "skipping derivation named '" << i.queryName()
+                    << "' which gives an assertion failure";
     } catch (Error& e) {
       e.addPrefix(
           fmt("while querying the derivation named '%1%':\n", i.queryName()));
@@ -1167,8 +1164,7 @@ static void switchGeneration(Globals& globals, int dstGen) {
       throw Error(format("generation %1% does not exist") % dstGen);
   }
 
-  printInfo(format("switching from generation %1% to %2%") % curGen %
-            dst.number);
+  LOG(INFO) << "switching from generation " << curGen << " to " << dst.number;
 
   if (globals.dryRun) return;
 
@@ -1330,7 +1326,7 @@ static int _main(int argc, char** argv) {
       else if (*arg == "--delete-generations")
         op = opDeleteGenerations;
       else if (*arg == "--dry-run") {
-        printInfo("(dry run; not doing anything)");
+        LOG(INFO) << "(dry run; not doing anything)";
         globals.dryRun = true;
       } else if (*arg == "--system-filter")
         globals.instSource.systemFilter = getArg(*arg, arg, end);
diff --git a/third_party/nix/src/nix-env/user-env.cc b/third_party/nix/src/nix-env/user-env.cc
index c1c174bcc529..b8d168c8355b 100644
--- a/third_party/nix/src/nix-env/user-env.cc
+++ b/third_party/nix/src/nix-env/user-env.cc
@@ -1,4 +1,5 @@
 #include "user-env.hh"
+#include <glog/logging.h>
 #include "derivations.hh"
 #include "eval-inline.hh"
 #include "eval.hh"
@@ -30,7 +31,7 @@ bool createUserEnv(EvalState& state, DrvInfos& elems, const Path& profile,
   for (auto& i : elems)
     if (i.queryDrvPath() != "") drvsToBuild.insert(i.queryDrvPath());
 
-  debug(format("building user environment dependencies"));
+  DLOG(INFO) << "building user environment dependencies";
   state.store->buildPaths(drvsToBuild, state.repair ? bmRepair : bmNormal);
 
   /* Construct the whole top level derivation. */
@@ -111,7 +112,7 @@ bool createUserEnv(EvalState& state, DrvInfos& elems, const Path& profile,
   mkApp(topLevel, envBuilder, args);
 
   /* Evaluate it. */
-  debug("evaluating user environment builder");
+  DLOG(INFO) << "evaluating user environment builder";
   state.forceValue(topLevel);
   PathSet context;
   Attr& aDrvPath(*topLevel.attrs->find(state.sDrvPath));
@@ -122,7 +123,7 @@ bool createUserEnv(EvalState& state, DrvInfos& elems, const Path& profile,
                                         *(aOutPath.value), context);
 
   /* Realise the resulting store expression. */
-  debug("building user environment");
+  DLOG(INFO) << "building user environment";
   state.store->buildPaths({topLevelDrv}, state.repair ? bmRepair : bmNormal);
 
   /* Switch the current user environment to the output path. */
@@ -134,13 +135,12 @@ bool createUserEnv(EvalState& state, DrvInfos& elems, const Path& profile,
 
     Path lockTokenCur = optimisticLockProfile(profile);
     if (lockToken != lockTokenCur) {
-      printError(
-          format("profile '%1%' changed while we were busy; restarting") %
-          profile);
+      LOG(WARNING) << "profile '" << profile
+                   << "' changed while we were busy; restarting";
       return false;
     }
 
-    debug(format("switching to new user environment"));
+    DLOG(INFO) << "switching to new user environment";
     Path generation =
         createGeneration(ref<LocalFSStore>(store2), profile, topLevelOut);
     switchLink(profile, generation);
diff --git a/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc b/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc
index 223f65c4a8e4..0f6b9454c0bf 100644
--- a/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc
+++ b/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc
@@ -1,4 +1,5 @@
 #include <fcntl.h>
+#include <glog/logging.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <iostream>
@@ -10,7 +11,6 @@
 #include "finally.hh"
 #include "hash.hh"
 #include "legacy.hh"
-#include "progress-bar.hh"
 #include "shared.hh"
 #include "store-api.hh"
 
@@ -92,10 +92,6 @@ static int _main(int argc, char** argv) {
 
     if (args.size() > 2) throw UsageError("too many arguments");
 
-    Finally f([]() { stopProgressBar(); });
-
-    if (isatty(STDERR_FILENO)) startProgressBar();
-
     auto store = openStore();
     auto state = std::make_unique<EvalState>(myArgs.searchPath, store);
 
@@ -126,7 +122,7 @@ static int _main(int argc, char** argv) {
       /* Extract the hash mode. */
       attr = v.attrs->find(state->symbols.create("outputHashMode"));
       if (attr == v.attrs->end())
-        printInfo("warning: this does not look like a fetchurl call");
+        LOG(WARNING) << "this does not look like a fetchurl call";
       else
         unpack = state->forceString(*attr->value) == "recursive";
 
@@ -176,7 +172,7 @@ static int _main(int argc, char** argv) {
 
       /* Optionally unpack the file. */
       if (unpack) {
-        printInfo("unpacking...");
+        LOG(INFO) << "unpacking...";
         Path unpacked = (Path)tmpDir + "/unpacked";
         createDirs(unpacked);
         if (hasSuffix(baseNameOf(uri), ".zip"))
@@ -210,9 +206,9 @@ static int _main(int argc, char** argv) {
       assert(storePath == store->makeFixedOutputPath(unpack, hash, name));
     }
 
-    stopProgressBar();
-
-    if (!printPath) printInfo(format("path is '%1%'") % storePath);
+    if (!printPath) {
+      LOG(INFO) << "path is '" << storePath << "'";
+    }
 
     std::cout << printHash16or32(hash) << std::endl;
     if (printPath) std::cout << storePath << std::endl;
diff --git a/third_party/nix/src/nix-store/nix-store.cc b/third_party/nix/src/nix-store/nix-store.cc
index 7f576b1b3ed9..0e42dfd34a43 100644
--- a/third_party/nix/src/nix-store/nix-store.cc
+++ b/third_party/nix/src/nix-store/nix-store.cc
@@ -1,4 +1,5 @@
 #include <fcntl.h>
+#include <glog/logging.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <algorithm>
@@ -715,7 +716,7 @@ static void opVerify(Strings opFlags, Strings opArgs) {
       throw UsageError(format("unknown flag '%1%'") % i);
 
   if (store->verifyStore(checkContents, repair)) {
-    printError("warning: not all errors were fixed");
+    LOG(WARNING) << "not all errors were fixed";
     throw Exit(1);
   }
 }
@@ -728,15 +729,15 @@ static void opVerifyPath(Strings opFlags, Strings opArgs) {
 
   for (auto& i : opArgs) {
     Path path = store->followLinksToStorePath(i);
-    printMsg(lvlTalkative, format("checking path '%1%'...") % path);
+    LOG(INFO) << "checking path '" << path << "'...";
     auto info = store->queryPathInfo(path);
     HashSink sink(info->narHash.type);
     store->narFromPath(path, sink);
     auto current = sink.finish();
     if (current.first != info->narHash) {
-      printError(
-          format("path '%1%' was modified! expected hash '%2%', got '%3%'") %
-          path % info->narHash.to_string() % current.first.to_string());
+      LOG(ERROR) << "path '" << path << "' was modified! expected hash '"
+                 << info->narHash.to_string() << "', got '"
+                 << current.first.to_string() << "'";
       status = 1;
     }
   }
@@ -788,7 +789,6 @@ static void opServe(Strings opFlags, Strings opArgs) {
   auto getBuildSettings = [&]() {
     // FIXME: changing options here doesn't work if we're
     // building through the daemon.
-    verbosity = lvlError;
     settings.keepLog = false;
     settings.useSubstitutes = false;
     settings.maxSilentTime = readInt(in);
@@ -836,7 +836,7 @@ static void opServe(Strings opFlags, Strings opArgs) {
           if (!willSubstitute.empty()) try {
               store->buildPaths(willSubstitute);
             } catch (Error& e) {
-              printError(format("warning: %1%") % e.msg());
+              LOG(WARNING) << e.msg();
             }
         }
 
diff --git a/third_party/nix/src/nix/edit.cc b/third_party/nix/src/nix/edit.cc
index 8f31e19a1049..631cae60ebc7 100644
--- a/third_party/nix/src/nix/edit.cc
+++ b/third_party/nix/src/nix/edit.cc
@@ -1,8 +1,8 @@
+#include <glog/logging.h>
 #include <unistd.h>
 #include "attr-path.hh"
 #include "command.hh"
 #include "eval.hh"
-#include "progress-bar.hh"
 #include "shared.hh"
 
 using namespace nix;
@@ -36,7 +36,7 @@ struct CmdEdit : InstallableCommand {
     }
 
     auto pos = state->forceString(*v2);
-    debug("position is %s", pos);
+    DLOG(INFO) << "position is " << pos;
 
     auto colon = pos.rfind(':');
     if (colon == std::string::npos)
@@ -61,8 +61,6 @@ struct CmdEdit : InstallableCommand {
 
     args.push_back(filename);
 
-    stopProgressBar();
-
     execvp(args.front().c_str(), stringsToCharPtrs(args).data());
 
     throw SysError("cannot run editor '%s'", editor);
diff --git a/third_party/nix/src/nix/eval.cc b/third_party/nix/src/nix/eval.cc
index 34d91ba1f0a9..9da265a641bd 100644
--- a/third_party/nix/src/nix/eval.cc
+++ b/third_party/nix/src/nix/eval.cc
@@ -2,7 +2,6 @@
 #include "command.hh"
 #include "common-args.hh"
 #include "json.hh"
-#include "progress-bar.hh"
 #include "shared.hh"
 #include "store-api.hh"
 #include "value-to-json.hh"
@@ -40,8 +39,6 @@ struct CmdEval : MixJSON, InstallableCommand {
     auto v = installable->toValue(*state);
     PathSet context;
 
-    stopProgressBar();
-
     if (raw) {
       std::cout << state->coerceToString(noPos, *v, context);
     } else if (json) {
diff --git a/third_party/nix/src/nix/installables.cc b/third_party/nix/src/nix/installables.cc
index 633b6d58e170..8a2a5fd19d94 100644
--- a/third_party/nix/src/nix/installables.cc
+++ b/third_party/nix/src/nix/installables.cc
@@ -241,9 +241,9 @@ Buildables build(ref<Store> store, RealiseMode mode,
     }
   }
 
-  if (mode == DryRun)
-    printMissing(store, pathsToBuild, lvlError);
-  else if (mode == Build)
+  if (mode == DryRun) {
+    printMissing(store, pathsToBuild);
+  } else if (mode == Build)
     store->buildPaths(pathsToBuild);
 
   return buildables;
diff --git a/third_party/nix/src/nix/log.cc b/third_party/nix/src/nix/log.cc
index 350d5c4a4999..3dab7746dd99 100644
--- a/third_party/nix/src/nix/log.cc
+++ b/third_party/nix/src/nix/log.cc
@@ -1,6 +1,6 @@
+#include <glog/logging.h>
 #include "command.hh"
 #include "common-args.hh"
-#include "progress-bar.hh"
 #include "shared.hh"
 #include "store-api.hh"
 
@@ -45,9 +45,8 @@ struct CmdLog : InstallableCommand {
         log = sub->getBuildLog(output.second);
       }
       if (!log) continue;
-      stopProgressBar();
-      printInfo("got build log for '%s' from '%s'", installable->what(),
-                sub->getUri());
+      LOG(INFO) << "got build log for '" << installable->what() << "' from '"
+                << sub->getUri() << "'";
       std::cout << *log;
       return;
     }
diff --git a/third_party/nix/src/nix/main.cc b/third_party/nix/src/nix/main.cc
index fac2c78a639e..cc4b8aef8411 100644
--- a/third_party/nix/src/nix/main.cc
+++ b/third_party/nix/src/nix/main.cc
@@ -12,7 +12,6 @@
 #include "globals.hh"
 #include "glog/logging.h"
 #include "legacy.hh"
-#include "progress-bar.hh"
 #include "shared.hh"
 #include "store-api.hh"
 
@@ -129,7 +128,6 @@ void mainWrapped(int argc, char** argv) {
     if (legacy) return legacy(argc, argv);
   }
 
-  verbosity = lvlWarn;
   settings.verboseBuild = false;
 
   NixArgs args;
@@ -140,14 +138,9 @@ void mainWrapped(int argc, char** argv) {
 
   if (!args.command) args.showHelpAndExit();
 
-  Finally f([]() { stopProgressBar(); });
-
-  startProgressBar(args.printBuildLogs);
-
   if (args.useNet && !haveInternet()) {
-    warn(
-        "you don't have Internet access; disabling some network-dependent "
-        "features");
+    LOG(WARNING) << "you don't have Internet access; "
+                 << "disabling some network-dependent features";
     args.useNet = false;
   }
 
diff --git a/third_party/nix/src/nix/meson.build b/third_party/nix/src/nix/meson.build
index a195ea1f25cd..259de78e2476 100644
--- a/third_party/nix/src/nix/meson.build
+++ b/third_party/nix/src/nix/meson.build
@@ -19,7 +19,6 @@ nix_src = files(
   join_paths(meson.source_root(), 'src/nix/optimise-store.cc'),
   join_paths(meson.source_root(), 'src/nix/path-info.cc'),
   join_paths(meson.source_root(), 'src/nix/ping-store.cc'),
-  join_paths(meson.source_root(), 'src/nix/progress-bar.cc'),
   join_paths(meson.source_root(), 'src/nix/repl.cc'),
   join_paths(meson.source_root(), 'src/nix/run.cc'),
   join_paths(meson.source_root(), 'src/nix/search.cc'),
@@ -47,7 +46,6 @@ nix_src = files(
 nix_headers = files (
   join_paths(meson.source_root(), 'src/nix/command.hh'),
   join_paths(meson.source_root(), 'src/nix/legacy.hh'),
-  join_paths(meson.source_root(), 'src/nix/progress-bar.hh'),
   join_paths(meson.source_root(), 'src/nix-env/user-env.hh'),
   join_paths(meson.source_root(), 'src/nix-store/dotgraph.hh'),
   join_paths(meson.source_root(), 'src/nix-store/graphml.hh'))
diff --git a/third_party/nix/src/nix/repl.cc b/third_party/nix/src/nix/repl.cc
index 72609fb16401..c47338073444 100644
--- a/third_party/nix/src/nix/repl.cc
+++ b/third_party/nix/src/nix/repl.cc
@@ -1,3 +1,4 @@
+#include <glog/logging.h>
 #include <setjmp.h>
 #include <climits>
 #include <cstdlib>
@@ -242,16 +243,13 @@ void NixRepl::mainLoop(const std::vector<std::string>& files) {
         // next line of input without clearing the input so far.
         continue;
       } else {
-        printMsg(lvlError, format(error + "%1%%2%") %
-                               (settings.showTrace ? e.prefix() : "") %
-                               e.msg());
+        LOG(ERROR) << error << (settings.showTrace ? e.prefix() : "")
+                   << e.msg();
       }
     } catch (Error& e) {
-      printMsg(lvlError, format(error + "%1%%2%") %
-                             (settings.showTrace ? e.prefix() : "") % e.msg());
+      LOG(ERROR) << error << (settings.showTrace ? e.prefix() : "") << e.msg();
     } catch (Interrupted& e) {
-      printMsg(lvlError, format(error + "%1%%2%") %
-                             (settings.showTrace ? e.prefix() : "") % e.msg());
+      LOG(ERROR) << error << (settings.showTrace ? e.prefix() : "") << e.msg();
     }
 
     // We handled the current input fully, so we should clear it
diff --git a/third_party/nix/src/nix/run.cc b/third_party/nix/src/nix/run.cc
index d78589172c1b..0b5a2648f9fb 100644
--- a/third_party/nix/src/nix/run.cc
+++ b/third_party/nix/src/nix/run.cc
@@ -5,7 +5,6 @@
 #include "finally.hh"
 #include "fs-accessor.hh"
 #include "local-store.hh"
-#include "progress-bar.hh"
 #include "shared.hh"
 #include "store-api.hh"
 
@@ -135,8 +134,6 @@ struct CmdRun : InstallablesCommand {
     Strings args;
     for (auto& arg : command) args.push_back(arg);
 
-    stopProgressBar();
-
     restoreSignals();
 
     restoreAffinity();
diff --git a/third_party/nix/src/nix/search.cc b/third_party/nix/src/nix/search.cc
index fab8bba6283a..90aea17a6e39 100644
--- a/third_party/nix/src/nix/search.cc
+++ b/third_party/nix/src/nix/search.cc
@@ -1,3 +1,4 @@
+#include <glog/logging.h>
 #include <fstream>
 #include <regex>
 #include "command.hh"
@@ -99,7 +100,7 @@ struct CmdSearch : SourceExprCommand, MixJSON {
 
     doExpr = [&](Value* v, std::string attrPath, bool toplevel,
                  JSONObject* cache) {
-      debug("at attribute '%s'", attrPath);
+      DLOG(INFO) << "at attribute '" << attrPath << "'";
 
       try {
         uint found = 0;
@@ -174,7 +175,7 @@ struct CmdSearch : SourceExprCommand, MixJSON {
             auto attrs = v->attrs;
             Bindings::iterator j = attrs->find(sRecurse);
             if (j == attrs->end() || !state->forceBool(*j->value, *j->pos)) {
-              debug("skip attribute '%s'", attrPath);
+              DLOG(INFO) << "skip attribute '" << attrPath << "'";
               return;
             }
           }
@@ -209,7 +210,7 @@ struct CmdSearch : SourceExprCommand, MixJSON {
     Path jsonCacheFileName = getCacheDir() + "/nix/package-search.json";
 
     if (useCache && pathExists(jsonCacheFileName)) {
-      warn("using cached results; pass '-u' to update the cache");
+      LOG(WARNING) << "using cached results; pass '-u' to update the cache";
 
       Value vRoot;
       parseJSON(*state, readFile(jsonCacheFileName), vRoot);
diff --git a/third_party/nix/src/nix/sigs.cc b/third_party/nix/src/nix/sigs.cc
index da453d1486fe..78ac8612e778 100644
--- a/third_party/nix/src/nix/sigs.cc
+++ b/third_party/nix/src/nix/sigs.cc
@@ -1,3 +1,4 @@
+#include <glog/logging.h>
 #include <atomic>
 #include "command.hh"
 #include "shared.hh"
@@ -82,7 +83,7 @@ struct CmdCopySigs : StorePathsCommand {
 
     pool.process();
 
-    printInfo(format("imported %d signatures") % added);
+    LOG(INFO) << "imported " << added << " signatures";
   }
 };
 
@@ -126,7 +127,7 @@ struct CmdSignPaths : StorePathsCommand {
       }
     }
 
-    printInfo(format("added %d signatures") % added);
+    LOG(INFO) << "added " << added << " signatures";
   }
 };
 
diff --git a/third_party/nix/src/nix/upgrade-nix.cc b/third_party/nix/src/nix/upgrade-nix.cc
index 66230a9ddf4f..96ce2305db60 100644
--- a/third_party/nix/src/nix/upgrade-nix.cc
+++ b/third_party/nix/src/nix/upgrade-nix.cc
@@ -1,10 +1,10 @@
+#include <glog/logging.h>
 #include "attr-path.hh"
 #include "command.hh"
 #include "common-args.hh"
 #include "download.hh"
 #include "eval.hh"
 #include "names.hh"
-#include "progress-bar.hh"
 #include "store-api.hh"
 
 using namespace nix;
@@ -53,48 +53,43 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand {
 
     if (profileDir == "") profileDir = getProfileDir(store);
 
-    printInfo("upgrading Nix in profile '%s'", profileDir);
+    LOG(INFO) << "upgrading Nix in profile '" << profileDir << "'";
 
     Path storePath;
     {
-      Activity act(*logger, lvlInfo, actUnknown, "querying latest Nix version");
+      LOG(INFO) << "querying latest Nix version";
       storePath = getLatestNix(store);
     }
 
     auto version = DrvName(storePathToName(storePath)).version;
 
     if (dryRun) {
-      stopProgressBar();
-      printError("would upgrade to version %s", version);
+      LOG(ERROR) << "would upgrade to version " << version;
       return;
     }
 
     {
-      Activity act(*logger, lvlInfo, actUnknown,
-                   fmt("downloading '%s'...", storePath));
+      LOG(INFO) << "downloading '" << storePath << "'...";
       store->ensurePath(storePath);
     }
 
     {
-      Activity act(*logger, lvlInfo, actUnknown,
-                   fmt("verifying that '%s' works...", storePath));
+      LOG(INFO) << "verifying that '" << storePath << "' works...";
       auto program = storePath + "/bin/nix-env";
       auto s = runProgram(program, false, {"--version"});
       if (s.find("Nix") == std::string::npos)
         throw Error("could not verify that '%s' works", program);
     }
 
-    stopProgressBar();
-
     {
-      Activity act(
-          *logger, lvlInfo, actUnknown,
-          fmt("installing '%s' into profile '%s'...", storePath, profileDir));
+      LOG(INFO) << "installing '" << storePath << "' into profile '"
+                << profileDir << "'...";
       runProgram(settings.nixBinDir + "/nix-env", false,
                  {"--profile", profileDir, "-i", storePath, "--no-sandbox"});
     }
 
-    printError(ANSI_GREEN "upgrade to version %s done" ANSI_NORMAL, version);
+    LOG(INFO) << ANSI_GREEN << "upgrade to version " << version << " done"
+              << ANSI_NORMAL;
   }
 
   /* Return the profile in which Nix is installed. */
@@ -111,10 +106,11 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand {
       throw Error(
           "couldn't figure out how Nix is installed, so I can't upgrade it");
 
-    printInfo("found Nix in '%s'", where);
+    LOG(INFO) << "found Nix in '" << where << "'";
 
-    if (hasPrefix(where, "/run/current-system"))
+    if (hasPrefix(where, "/run/current-system")) {
       throw Error("Nix on NixOS must be upgraded via 'nixos-rebuild'");
+    }
 
     Path profileDir = dirOf(where);
 
@@ -123,7 +119,7 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand {
            isLink(profileDir))
       profileDir = readLink(profileDir);
 
-    printInfo("found profile '%s'", profileDir);
+    LOG(INFO) << "found profile '" << profileDir << "'";
 
     Path userEnv = canonPath(profileDir, true);
 
diff --git a/third_party/nix/src/nix/verify.cc b/third_party/nix/src/nix/verify.cc
index 87405b7b37d1..73c3649b1470 100644
--- a/third_party/nix/src/nix/verify.cc
+++ b/third_party/nix/src/nix/verify.cc
@@ -1,3 +1,4 @@
+#include <glog/logging.h>
 #include <atomic>
 #include "command.hh"
 #include "shared.hh"
@@ -53,29 +54,21 @@ struct CmdVerify : StorePathsCommand {
 
     auto publicKeys = getDefaultPublicKeys();
 
-    Activity act(*logger, actVerifyPaths);
-
     std::atomic<size_t> done{0};
     std::atomic<size_t> untrusted{0};
     std::atomic<size_t> corrupted{0};
     std::atomic<size_t> failed{0};
     std::atomic<size_t> active{0};
 
-    auto update = [&]() {
-      act.progress(done, storePaths.size(), active, failed);
-    };
-
     ThreadPool pool;
 
     auto doPath = [&](const Path& storePath) {
       try {
         checkInterrupt();
 
-        Activity act2(*logger, lvlInfo, actUnknown,
-                      fmt("checking '%s'", storePath));
+        LOG(INFO) << "checking '" << storePath << "'";
 
         MaintainCount<std::atomic<size_t>> mcActive(active);
-        update();
 
         auto info = store->queryPathInfo(storePath);
 
@@ -87,11 +80,10 @@ struct CmdVerify : StorePathsCommand {
 
           if (hash.first != info->narHash) {
             corrupted++;
-            act2.result(resCorruptedPath, info->path);
-            printError(
-                format("path '%s' was modified! expected hash '%s', got '%s'") %
-                info->path % info->narHash.to_string() %
-                hash.first.to_string());
+            LOG(WARNING) << "path '" << info->path
+                         << "' was modified! expected hash '"
+                         << info->narHash.to_string() << "', got '"
+                         << hash.first.to_string() << "'";
           }
         }
 
@@ -130,8 +122,7 @@ struct CmdVerify : StorePathsCommand {
                 doSigs(info2->sigs);
               } catch (InvalidPath&) {
               } catch (Error& e) {
-                printError(format(ANSI_RED "error:" ANSI_NORMAL " %s") %
-                           e.what());
+                LOG(ERROR) << e.what();
               }
             }
 
@@ -140,19 +131,16 @@ struct CmdVerify : StorePathsCommand {
 
           if (!good) {
             untrusted++;
-            act2.result(resUntrustedPath, info->path);
-            printError(format("path '%s' is untrusted") % info->path);
+            LOG(WARNING) << "path '" << info->path << "' is untrusted";
           }
         }
 
         done++;
 
       } catch (Error& e) {
-        printError(format(ANSI_RED "error:" ANSI_NORMAL " %s") % e.what());
+        LOG(ERROR) << e.what();
         failed++;
       }
-
-      update();
     };
 
     for (auto& storePath : storePaths)
diff --git a/third_party/nix/src/nix/why-depends.cc b/third_party/nix/src/nix/why-depends.cc
index 7b8650a4e8eb..e169d1c5085a 100644
--- a/third_party/nix/src/nix/why-depends.cc
+++ b/third_party/nix/src/nix/why-depends.cc
@@ -1,7 +1,7 @@
+#include <glog/logging.h>
 #include <queue>
 #include "command.hh"
 #include "fs-accessor.hh"
-#include "progress-bar.hh"
 #include "shared.hh"
 #include "store-api.hh"
 
@@ -67,13 +67,11 @@ struct CmdWhyDepends : SourceExprCommand {
     store->computeFSClosure({packagePath}, closure, false, false);
 
     if (!closure.count(dependencyPath)) {
-      printError("'%s' does not depend on '%s'", package->what(),
-                 dependency->what());
+      LOG(WARNING) << "'" << package->what() << "' does not depend on '"
+                   << dependency->what() << "'";
       return;
     }
 
-    stopProgressBar();  // FIXME
-
     auto accessor = store->getFSAccessor();
 
     auto const inf = std::numeric_limits<size_t>::max();