about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/gc.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-11-22T15·06+0100
committerglittershark <grfn@gws.fyi>2020-09-01T02·21+0000
commit785cb3a75476033ba6eec2fef334d47d8e64388a (patch)
tree676d53868e29e0ab28443b9d13019c54754012f7 /third_party/nix/src/libstore/gc.cc
parentc5f3b12f0484cd1a5152b6c64a336e9852d7c484 (diff)
refactor(tvix): getEnv(): Return std::optional r/1756
This allows distinguishing between an empty value and no value.

Patch ported from upstream at
https://github.com/NixOS/nix/commit/ba87b08f8529e4d9f8c58d8c625152058ceadb75

Change-Id: I061cc8e16b1a7a0341adfc3b0edca1c0c51d5c97
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1884
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Diffstat (limited to 'third_party/nix/src/libstore/gc.cc')
-rw-r--r--third_party/nix/src/libstore/gc.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/third_party/nix/src/libstore/gc.cc b/third_party/nix/src/libstore/gc.cc
index 4f04e09a75..50c52bb009 100644
--- a/third_party/nix/src/libstore/gc.cc
+++ b/third_party/nix/src/libstore/gc.cc
@@ -906,7 +906,8 @@ void LocalStore::collectGarbage(const GCOptions& options, GCResults& results) {
 }
 
 void LocalStore::autoGC(bool sync) {
-  static auto fakeFreeSpaceFile = getEnv("_NIX_TEST_FREE_SPACE_FILE", "");
+  static auto fakeFreeSpaceFile =
+      getEnv("_NIX_TEST_FREE_SPACE_FILE").value_or("");
 
   auto getAvail = [this]() -> uint64_t {
     if (!fakeFreeSpaceFile.empty()) {