about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/globals.cc8
-rw-r--r--src/libstore/globals.hh2
-rw-r--r--src/libstore/remote-store.cc2
3 files changed, 12 insertions, 0 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index 82f3e952a0b5..e9fe0beca4ef 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -122,6 +122,14 @@ void Settings::set(const string & name, const string & value)
 }
 
 
+string Settings::get(const string & name, const string & def)
+{
+    auto i = settings.find(name);
+    if (i == settings.end()) return def;
+    return i->second;
+}
+
+
 void Settings::update()
 {
     get(tryFallback, "build-fallback");
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index f1748336fdac..d16969c9e010 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -21,6 +21,8 @@ struct Settings {
 
     void set(const string & name, const string & value);
 
+    string get(const string & name, const string & def = "");
+
     void update();
 
     string pack();
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index b3967bb2418f..7c51f395aae2 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -163,6 +163,8 @@ void RemoteStore::setOptions()
 
     if (GET_PROTOCOL_MINOR(daemonVersion) >= 12) {
         Settings::SettingsMap overrides = settings.getOverrides();
+        if (overrides["ssh-auth-sock"] == "")
+            overrides["ssh-auth-sock"] = getEnv("SSH_AUTH_SOCK");
         writeInt(overrides.size(), to);
         foreach (Settings::SettingsMap::iterator, i, overrides) {
             writeString(i->first, to);