File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#include " nix/store/s3-url.hh"
22#include " nix/util/tests/gmock-matchers.hh"
33
4- #if NIX_WITH_S3_SUPPORT
4+ #if NIX_WITH_S3_SUPPORT || NIX_WITH_CURL_S3
55
66# include < gtest/gtest.h>
77# include < gmock/gmock.h>
Original file line number Diff line number Diff line change 11#include " nix/store/aws-creds.hh"
22
3- #if NIX_WITH_S3_SUPPORT
3+ #if NIX_WITH_CURL_S3
44
55# include < aws/crt/Types.h>
66# include " nix/store/s3-url.hh"
Original file line number Diff line number Diff line change 22// /@file
33#include " nix/store/config.hh"
44
5- #if NIX_WITH_S3_SUPPORT
5+ #if NIX_WITH_CURL_S3
66
77# include " nix/store/s3-url.hh"
88# include " nix/util/error.hh"
Original file line number Diff line number Diff line change 22// /@file
33#include " nix/store/config.hh"
44
5- #if NIX_WITH_S3_SUPPORT
5+ #if NIX_WITH_S3_SUPPORT || NIX_WITH_CURL_S3
66
77# include " nix/util/url.hh"
88# include " nix/util/util.hh"
Original file line number Diff line number Diff line change @@ -164,6 +164,33 @@ if aws_s3.found()
164164endif
165165deps_other += aws_s3
166166
167+ # Curl-based S3 store support (alternative to AWS SDK)
168+ # Check if curl supports AWS SigV4 (requires >= 7.75.0)
169+ curl_supports_aws_sigv4 = curl.version().version_compare(' >= 7.75.0' )
170+ # AWS CRT C++ for lightweight credential management
171+ aws_crt_cpp = cxx.find_library (' aws-crt-cpp' , required : false )
172+
173+ curl_s3_store_opt = get_option (' curl-s3-store' ).require(
174+ curl_supports_aws_sigv4,
175+ error_message : ' curl-based S3 support requires curl >= 7.75.0' ,
176+ ).require(
177+ aws_crt_cpp.found(),
178+ error_message : ' curl-based S3 support requires aws-crt-cpp' ,
179+ )
180+
181+ # Make AWS SDK and curl-based S3 mutually exclusive
182+ if aws_s3.found() and curl_s3_store_opt.enabled()
183+ error (
184+ ' Cannot enable both AWS SDK S3 support and curl-based S3 support. Please choose one.' ,
185+ )
186+ endif
187+
188+ if curl_s3_store_opt.enabled()
189+ deps_other += aws_crt_cpp
190+ endif
191+
192+ configdata_pub.set(' NIX_WITH_CURL_S3' , curl_s3_store_opt.enabled().to_int())
193+
167194subdir (' nix-meson-build-support/generate-header' )
168195
169196generated_headers = []
Original file line number Diff line number Diff line change @@ -33,3 +33,10 @@ option(
3333 value : ' /nix/var/log/nix' ,
3434 description : ' path to store logs in for Nix' ,
3535)
36+
37+ option (
38+ ' curl-s3-store' ,
39+ type : ' feature' ,
40+ value : ' disabled' ,
41+ description : ' Enable curl-based S3 binary cache store support (requires aws-crt-cpp and curl >= 7.75.0)' ,
42+ )
Original file line number Diff line number Diff line change 1010 boost ,
1111 curl ,
1212 aws-sdk-cpp ,
13+ aws-crt-cpp ,
1314 libseccomp ,
1415 nlohmann_json ,
1516 sqlite ,
2526 withAWS ?
2627 # Default is this way because there have been issues building this dependency
2728 stdenv . hostPlatform == stdenv . buildPlatform && ( stdenv . isLinux || stdenv . isDarwin ) ,
29+
30+ withCurlS3 ? false ,
2831} :
2932
3033let
@@ -64,7 +67,8 @@ mkMesonLibrary (finalAttrs: {
6467 sqlite
6568 ]
6669 ++ lib . optional stdenv . hostPlatform . isLinux libseccomp
67- ++ lib . optional withAWS aws-sdk-cpp ;
70+ ++ lib . optional withAWS aws-sdk-cpp
71+ ++ lib . optional withCurlS3 aws-crt-cpp ;
6872
6973 propagatedBuildInputs = [
7074 nix-util
@@ -74,6 +78,7 @@ mkMesonLibrary (finalAttrs: {
7478 mesonFlags = [
7579 ( lib . mesonEnable "seccomp-sandboxing" stdenv . hostPlatform . isLinux )
7680 ( lib . mesonBool "embedded-sandbox-shell" embeddedSandboxShell )
81+ ( lib . mesonEnable "curl-s3-store" withCurlS3 )
7782 ]
7883 ++ lib . optionals stdenv . hostPlatform . isLinux [
7984 ( lib . mesonOption "sandbox-shell" "${ busybox-sandbox-shell } /bin/busybox" )
Original file line number Diff line number Diff line change 11#include " nix/store/s3-url.hh"
22
3- #if NIX_WITH_S3_SUPPORT
3+ #if NIX_WITH_S3_SUPPORT || NIX_WITH_CURL_S3
44
55# include " nix/util/error.hh"
66# include " nix/util/split.hh"
You can’t perform that action at this time.
0 commit comments