Skip to content

Commit 1dc92c1

Browse files
committed
fix(libstore): restore S3 store registration
After removing the legacy S3 implementation in c833b26, the store registration for s3:// URLs was accidentally lost. This caused commands like `nix store info --store s3://bucket` to fail with "don't know how to open Nix store with scheme 's3'". This commit restores S3 support by: 1. Adding "s3" to HttpBinaryCacheStore's supported URI schemes when built with AWS CRT support 2. Fixing the S3-to-HTTPS URL conversion in TransferItem::init() to use the converted URL The S3 functionality is now handled through the curl-based file transfer layer with AWS SigV4 authentication, as intended by issue #13084.
1 parent 6700144 commit 1dc92c1

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/libstore/filetransfer.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,14 @@ struct curlFileTransfer : public FileTransfer
405405
curl_easy_setopt(req, CURLOPT_DEBUGFUNCTION, TransferItem::debugCallback);
406406
}
407407

408-
curl_easy_setopt(req, CURLOPT_URL, request.uri.c_str());
408+
// Use the actual URL, which may have been transformed from s3:// to https://
409+
std::string actualUrl = request.uri;
410+
#if NIX_WITH_AWS_CRT_SUPPORT
411+
if (isS3Request && !result.urls.empty()) {
412+
actualUrl = result.urls[0];
413+
}
414+
#endif
415+
curl_easy_setopt(req, CURLOPT_URL, actualUrl.c_str());
409416
curl_easy_setopt(req, CURLOPT_FOLLOWLOCATION, 1L);
410417
curl_easy_setopt(req, CURLOPT_MAXREDIRS, 10);
411418
curl_easy_setopt(req, CURLOPT_NOSIGNAL, 1);

src/libstore/http-binary-cache-store.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ StringSet HttpBinaryCacheStoreConfig::uriSchemes()
1515
auto ret = StringSet{"http", "https"};
1616
if (forceHttp)
1717
ret.insert("file");
18+
#if NIX_WITH_AWS_CRT_SUPPORT
19+
// S3 support is now handled via curl with AWS SigV4 authentication
20+
ret.insert("s3");
21+
#endif
1822
return ret;
1923
}
2024

0 commit comments

Comments
 (0)