about summary refs log tree commit diff
path: root/third_party/nix/src
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src')
-rw-r--r--third_party/nix/src/libexpr/primops.cc22
-rw-r--r--third_party/nix/src/libstore/binary-cache-store.cc8
-rw-r--r--third_party/nix/src/libstore/build.cc17
-rw-r--r--third_party/nix/src/libstore/download.cc22
-rw-r--r--third_party/nix/src/libstore/local-fs-store.cc6
-rw-r--r--third_party/nix/src/libstore/worker-protocol.hh2
-rw-r--r--third_party/nix/src/nix-env/nix-env.cc11
-rw-r--r--third_party/nix/src/nix/hash.cc18
-rw-r--r--third_party/nix/src/nix/ls.cc5
9 files changed, 50 insertions, 61 deletions
diff --git a/third_party/nix/src/libexpr/primops.cc b/third_party/nix/src/libexpr/primops.cc
index 761ff954a433..5278734dcb6c 100644
--- a/third_party/nix/src/libexpr/primops.cc
+++ b/third_party/nix/src/libexpr/primops.cc
@@ -964,12 +964,10 @@ static void prim_readDir(EvalState& state, const Pos& pos, Value** args,
     if (ent.type == DT_UNKNOWN) {
       ent.type = getFileType(path + "/" + ent.name);
     }
-    mkStringNoCopy(*ent_val,
-                   ent.type == DT_REG
-                       ? "regular"
-                       : ent.type == DT_DIR
-                             ? "directory"
-                             : ent.type == DT_LNK ? "symlink" : "unknown");
+    mkStringNoCopy(*ent_val, ent.type == DT_REG   ? "regular"
+                             : ent.type == DT_DIR ? "directory"
+                             : ent.type == DT_LNK ? "symlink"
+                                                  : "unknown");
   }
 }
 
@@ -1055,13 +1053,11 @@ static void addPath(EvalState& state, const Pos& pos, const std::string& name,
     state.callFunction(*filterFun, arg1, fun2, noPos);
 
     Value arg2;
-    mkString(arg2, S_ISREG(st.st_mode)
-                       ? "regular"
-                       : S_ISDIR(st.st_mode)
-                             ? "directory"
-                             : S_ISLNK(st.st_mode)
-                                   ? "symlink"
-                                   : "unknown" /* not supported, will fail! */);
+    mkString(arg2, S_ISREG(st.st_mode)   ? "regular"
+                   : S_ISDIR(st.st_mode) ? "directory"
+                   : S_ISLNK(st.st_mode)
+                       ? "symlink"
+                       : "unknown" /* not supported, will fail! */);
 
     Value res;
     state.callFunction(fun2, arg2, res, noPos);
diff --git a/third_party/nix/src/libstore/binary-cache-store.cc b/third_party/nix/src/libstore/binary-cache-store.cc
index e5b7ef2cdc3e..0b04e972da7c 100644
--- a/third_party/nix/src/libstore/binary-cache-store.cc
+++ b/third_party/nix/src/libstore/binary-cache-store.cc
@@ -214,10 +214,10 @@ void BinaryCacheStore::addToStore(const ValidPathInfo& info,
 
   /* Atomically write the NAR file. */
   narInfo->url = "nar/" + narInfo->fileHash.to_string(Base32, false) + ".nar" +
-                 (compression == "xz" ? ".xz"
-                                      : compression == "bzip2"
-                                            ? ".bz2"
-                                            : compression == "br" ? ".br" : "");
+                 (compression == "xz"      ? ".xz"
+                  : compression == "bzip2" ? ".bz2"
+                  : compression == "br"    ? ".br"
+                                           : "");
   if ((repair != 0u) || !fileExists(narInfo->url)) {
     stats.narWrite++;
     upsertFile(narInfo->url, *narCompressed, "application/x-nix-nar");
diff --git a/third_party/nix/src/libstore/build.cc b/third_party/nix/src/libstore/build.cc
index e50f4cfa9901..2479b9a59c6c 100644
--- a/third_party/nix/src/libstore/build.cc
+++ b/third_party/nix/src/libstore/build.cc
@@ -1462,12 +1462,10 @@ void DerivationGoal::tryToBuild() {
   bool buildLocally = buildMode != bmNormal || parsedDrv->willBuildLocally();
 
   auto started = [&]() {
-    auto msg = fmt(buildMode == bmRepair
-                       ? "repairing outputs of '%s'"
-                       : buildMode == bmCheck
-                             ? "checking outputs of '%s'"
-                             : nrRounds > 1 ? "building '%s' (round %d/%d)"
-                                            : "building '%s'",
+    auto msg = fmt(buildMode == bmRepair  ? "repairing outputs of '%s'"
+                   : buildMode == bmCheck ? "checking outputs of '%s'"
+                   : nrRounds > 1         ? "building '%s' (round %d/%d)"
+                                          : "building '%s'",
                    drvPath, curRound, nrRounds);
 
     if (hook) {
@@ -1748,10 +1746,9 @@ void DerivationGoal::buildDone() {
     else {
       st = dynamic_cast<NotDeterministic*>(&e) != nullptr
                ? BuildResult::NotDeterministic
-               : statusOk(status)
-                     ? BuildResult::OutputRejected
-                     : fixedOutput || diskFull ? BuildResult::TransientFailure
-                                               : BuildResult::PermanentFailure;
+           : statusOk(status)        ? BuildResult::OutputRejected
+           : fixedOutput || diskFull ? BuildResult::TransientFailure
+                                     : BuildResult::PermanentFailure;
     }
 
     done(st, e.msg());
diff --git a/third_party/nix/src/libstore/download.cc b/third_party/nix/src/libstore/download.cc
index ee2ce8152dbc..a2eed7ced8e3 100644
--- a/third_party/nix/src/libstore/download.cc
+++ b/third_party/nix/src/libstore/download.cc
@@ -435,17 +435,17 @@ struct CurlDownloader : public Downloader {
             code == CURLE_ABORTED_BY_CALLBACK && _isInterrupted
                 ? DownloadError(Interrupted, fmt("%s of '%s' was interrupted",
                                                  request.verb(), request.uri))
-                : httpStatus != 0
-                      ? DownloadError(
-                            err, fmt("unable to %s '%s': HTTP error %d",
-                                     request.verb(), request.uri, httpStatus) +
-                                     (code == CURLE_OK
-                                          ? ""
-                                          : fmt(" (curl error: %s)",
-                                                curl_easy_strerror(code))))
-                      : DownloadError(err, fmt("unable to %s '%s': %s (%d)",
-                                               request.verb(), request.uri,
-                                               curl_easy_strerror(code), code));
+            : httpStatus != 0
+                ? DownloadError(
+                      err,
+                      fmt("unable to %s '%s': HTTP error %d", request.verb(),
+                          request.uri, httpStatus) +
+                          (code == CURLE_OK ? ""
+                                            : fmt(" (curl error: %s)",
+                                                  curl_easy_strerror(code))))
+                : DownloadError(
+                      err, fmt("unable to %s '%s': %s (%d)", request.verb(),
+                               request.uri, curl_easy_strerror(code), code));
 
         /* If this is a transient error, then maybe retry the
            download after a while. If we're writing to a
diff --git a/third_party/nix/src/libstore/local-fs-store.cc b/third_party/nix/src/libstore/local-fs-store.cc
index 2ebf99a9b5a2..f2235bad7677 100644
--- a/third_party/nix/src/libstore/local-fs-store.cc
+++ b/third_party/nix/src/libstore/local-fs-store.cc
@@ -38,9 +38,9 @@ struct LocalStoreAccessor : public FSAccessor {
       throw Error(format("file '%1%' has unsupported type") % path);
     }
 
-    return {S_ISREG(st.st_mode)
-                ? Type::tRegular
-                : S_ISLNK(st.st_mode) ? Type::tSymlink : Type::tDirectory,
+    return {S_ISREG(st.st_mode)   ? Type::tRegular
+            : S_ISLNK(st.st_mode) ? Type::tSymlink
+                                  : Type::tDirectory,
             S_ISREG(st.st_mode) ? static_cast<uint64_t>(st.st_size) : 0,
             S_ISREG(st.st_mode) && ((st.st_mode & S_IXUSR) != 0u)};
   }
diff --git a/third_party/nix/src/libstore/worker-protocol.hh b/third_party/nix/src/libstore/worker-protocol.hh
index e2f40a449d86..47095253a129 100644
--- a/third_party/nix/src/libstore/worker-protocol.hh
+++ b/third_party/nix/src/libstore/worker-protocol.hh
@@ -53,7 +53,7 @@ typedef enum {
 } WorkerOp;
 
 #define STDERR_NEXT 0x6f6c6d67
-#define STDERR_READ 0x64617461   // data needed from source
+#define STDERR_READ 0x64617461  // data needed from source
 #define STDERR_WRITE 0x64617416  // data for sink
 #define STDERR_LAST 0x616c7473
 #define STDERR_ERROR 0x63787470
diff --git a/third_party/nix/src/nix-env/nix-env.cc b/third_party/nix/src/nix-env/nix-env.cc
index ee36510f02a4..15f12abd97e9 100644
--- a/third_party/nix/src/nix-env/nix-env.cc
+++ b/third_party/nix/src/nix-env/nix-env.cc
@@ -260,13 +260,10 @@ static DrvInfos filterBySelector(EvalState& state, const DrvInfos& allElems,
         auto k = newest.find(drvName.name);
 
         if (k != newest.end()) {
-          d = j.first.querySystem() == k->second.first.querySystem()
-                  ? 0
-                  : j.first.querySystem() == settings.thisSystem
-                        ? 1
-                        : k->second.first.querySystem() == settings.thisSystem
-                              ? -1
-                              : 0;
+          d = j.first.querySystem() == k->second.first.querySystem() ? 0
+              : j.first.querySystem() == settings.thisSystem         ? 1
+              : k->second.first.querySystem() == settings.thisSystem ? -1
+                                                                     : 0;
           if (d == 0) {
             d = comparePriorities(state, j.first, k->second.first);
           }
diff --git a/third_party/nix/src/nix/hash.cc b/third_party/nix/src/nix/hash.cc
index 08ada7ccfb3a..a40f7b4c859a 100644
--- a/third_party/nix/src/nix/hash.cc
+++ b/third_party/nix/src/nix/hash.cc
@@ -58,18 +58,18 @@ struct CmdToBase final : Command {
   }
 
   std::string name() override {
-    return base == Base16
-               ? "to-base16"
-               : base == Base32 ? "to-base32"
-                                : base == Base64 ? "to-base64" : "to-sri";
+    return base == Base16   ? "to-base16"
+           : base == Base32 ? "to-base32"
+           : base == Base64 ? "to-base64"
+                            : "to-sri";
   }
 
   std::string description() override {
-    return fmt(
-        "convert a hash to %s representation",
-        base == Base16
-            ? "base-16"
-            : base == Base32 ? "base-32" : base == Base64 ? "base-64" : "SRI");
+    return fmt("convert a hash to %s representation",
+               base == Base16   ? "base-16"
+               : base == Base32 ? "base-32"
+               : base == Base64 ? "base-64"
+                                : "SRI");
   }
 
   void run() override {
diff --git a/third_party/nix/src/nix/ls.cc b/third_party/nix/src/nix/ls.cc
index afa4db92bc61..d6ff1aaf816a 100644
--- a/third_party/nix/src/nix/ls.cc
+++ b/third_party/nix/src/nix/ls.cc
@@ -31,9 +31,8 @@ struct MixLs : virtual Args, MixJSON {
         auto st = accessor->stat(curPath);
         std::string tp = st.type == FSAccessor::Type::tRegular
                              ? (st.isExecutable ? "-r-xr-xr-x" : "-r--r--r--")
-                             : st.type == FSAccessor::Type::tSymlink
-                                   ? "lrwxrwxrwx"
-                                   : "dr-xr-xr-x";
+                         : st.type == FSAccessor::Type::tSymlink ? "lrwxrwxrwx"
+                                                                 : "dr-xr-xr-x";
         std::cout << (format("%s %20d %s") % tp % st.fileSize % relPath);
         if (st.type == FSAccessor::Type::tSymlink) {
           std::cout << " -> " << accessor->readLink(curPath);