about summary refs log tree commit diff
path: root/third_party/nix/src/nix-env/user-env.cc
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-08-14T02·06-0400
committerglittershark <grfn@gws.fyi>2020-08-14T03·06+0000
commitd1c38d9597e110bef92a548c86a651174bd385dc (patch)
tree98d64ac81a4f7ca91ad21f732c84bdc3f73df9cb /third_party/nix/src/nix-env/user-env.cc
parentaef3607bd332a9a6adbb150abe63250745972532 (diff)
refactor(tvix): Make Store::buildPaths return a Status r/1649
Make Store::buildPaths return a Status with [[nodiscard]] rather than
throwing exceptions to signal failure. This is the beginning of a long
road to refactor the entire store API to be status/statusor based
instead of using exceptions.

Change-Id: I2e32371c95a25b87ad129987c217d49c6d6e0c85
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1745
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Diffstat (limited to 'third_party/nix/src/nix-env/user-env.cc')
-rw-r--r--third_party/nix/src/nix-env/user-env.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/third_party/nix/src/nix-env/user-env.cc b/third_party/nix/src/nix-env/user-env.cc
index 06329e74f340..0cb921c8249d 100644
--- a/third_party/nix/src/nix-env/user-env.cc
+++ b/third_party/nix/src/nix-env/user-env.cc
@@ -9,6 +9,7 @@
 #include "libstore/globals.hh"
 #include "libstore/profiles.hh"
 #include "libstore/store-api.hh"
+#include "libutil/status.hh"
 #include "libutil/util.hh"
 
 namespace nix {
@@ -37,8 +38,8 @@ bool createUserEnv(EvalState& state, DrvInfos& elems, const Path& profile,
   }
 
   DLOG(INFO) << "building user environment dependencies";
-  state.store->buildPaths(drvsToBuild,
-                          state.repair != 0u ? bmRepair : bmNormal);
+  util::OkOrThrow(state.store->buildPaths(
+      drvsToBuild, state.repair != 0u ? bmRepair : bmNormal));
 
   /* Construct the whole top level derivation. */
   PathSet references;
@@ -137,8 +138,8 @@ bool createUserEnv(EvalState& state, DrvInfos& elems, const Path& profile,
 
   /* Realise the resulting store expression. */
   DLOG(INFO) << "building user environment";
-  state.store->buildPaths({topLevelDrv},
-                          state.repair != 0u ? bmRepair : bmNormal);
+  util::OkOrThrow(state.store->buildPaths(
+      {topLevelDrv}, state.repair != 0u ? bmRepair : bmNormal));
 
   /* Switch the current user environment to the output path. */
   auto store2 = state.store.dynamic_pointer_cast<LocalFSStore>();