1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-22 18:29:36 +01:00

refactor(libstore): replace AWS SDK with curl-based S3 implementation

This commit replaces the AWS C++ SDK with a lighter curl-based approach
for S3 binary cache operations.

- Removed dependency on the heavy aws-cpp-sdk-s3 and aws-cpp-sdk-transfer
- Added lightweight aws-crt-cpp for credential resolution only
- Leverages curl's native AWS SigV4 authentication (requires curl >= 7.75.0)
- S3BinaryCacheStore now delegates to HttpBinaryCacheStore
- Function s3ToHttpsUrl converts ParsedS3URL to ParsedURL
- Multipart uploads are no longer supported (may be reimplemented later)
- Build now requires curl >= 7.75.0 for AWS SigV4 support

Fixes: #13084, #12671, #11748, #12403, #5947
This commit is contained in:
Bernardo Meurer Costa 2025-08-21 05:38:42 +00:00
parent a543519ca9
commit 9295c14a35
No known key found for this signature in database
18 changed files with 14 additions and 1002 deletions

View file

@ -142,29 +142,7 @@ deps_public += nlohmann_json
sqlite = dependency('sqlite3', 'sqlite', version : '>=3.6.19')
deps_private += sqlite
# AWS C++ SDK has bad pkg-config. See
# https://github.com/aws/aws-sdk-cpp/issues/2673 for details.
aws_s3 = dependency('aws-cpp-sdk-s3', required : false)
# The S3 store definitions in the header will be hidden based on this variables.
configdata_pub.set('NIX_WITH_S3_SUPPORT', aws_s3.found().to_int())
if aws_s3.found()
aws_s3 = declare_dependency(
include_directories : include_directories(aws_s3.get_variable('includedir')),
link_args : [
'-L' + aws_s3.get_variable('libdir'),
'-laws-cpp-sdk-transfer',
'-laws-cpp-sdk-s3',
'-laws-cpp-sdk-identity-management',
'-laws-cpp-sdk-cognito-identity',
'-laws-cpp-sdk-sts',
'-laws-cpp-sdk-core',
'-laws-crt-cpp',
],
).as_system('system')
endif
deps_other += aws_s3
# Curl-based S3 store support (alternative to AWS SDK)
# Curl-based S3 store support
# Check if curl supports AWS SigV4 (requires >= 7.75.0)
curl_supports_aws_sigv4 = curl.version().version_compare('>= 7.75.0')
# AWS CRT C++ for lightweight credential management
@ -178,13 +156,6 @@ curl_s3_store_opt = get_option('curl-s3-store').require(
error_message : 'curl-based S3 support requires aws-crt-cpp',
)
# Make AWS SDK and curl-based S3 mutually exclusive
if aws_s3.found() and curl_s3_store_opt.enabled()
error(
'Cannot enable both AWS SDK S3 support and curl-based S3 support. Please choose one.',
)
endif
if curl_s3_store_opt.enabled()
deps_other += aws_crt_cpp
endif