@@ -24,7 +24,9 @@ UDSRemoteStoreConfig::UDSRemoteStoreConfig(
2424 : Store::Config{params}
2525 , LocalFSStore::Config{params}
2626 , RemoteStore::Config{params}
27- , path{authority.empty () ? settings.nixDaemonSocketFile .string () : authority}
27+ , path{
28+ !authority.empty () ? std::string{authority}
29+ : getEnvNonEmpty (" NIX_DAEMON_SOCKET_PATH" ).value_or (getDefaultDaemonSocketPath ().string ())}
2830{
2931 if (uriSchemes ().count (scheme) == 0 ) {
3032 throw UsageError (" Scheme must be 'unix'" );
@@ -38,10 +40,8 @@ std::string UDSRemoteStoreConfig::doc()
3840 ;
3941}
4042
41- // A bit gross that we now pass empty string but this is knowing that
42- // empty string will later default to the same nixDaemonSocketFile. Why
43- // don't we just wire it all through? I believe there are cases where it
44- // will live reload so we want to continue to account for that.
43+ // Empty authority will default to the per-store socket path based on
44+ // stateDir.
4545UDSRemoteStoreConfig::UDSRemoteStoreConfig (const Params & params)
4646 : UDSRemoteStoreConfig(*uriSchemes ().begin(), "", params)
4747{
@@ -60,7 +60,7 @@ StoreReference UDSRemoteStoreConfig::getReference() const
6060 /* We specifically return "daemon" here instead of "unix://" or "unix://${path}"
6161 * to be more compatible with older versions of nix. Some tooling out there
6262 * tries hard to parse store references and it might not be able to handle "unix://". */
63- if (path == settings. nixDaemonSocketFile )
63+ if (path == getEnvNonEmpty ( " NIX_DAEMON_SOCKET_PATH " ). value_or ( getDefaultDaemonSocketPath (). string ()) )
6464 return {
6565 .variant = StoreReference::Daemon{},
6666 .params = getQueryParams (),
0 commit comments