File tree Expand file tree Collapse file tree 8 files changed +45
-6
lines changed Expand file tree Collapse file tree 8 files changed +45
-6
lines changed Original file line number Diff line number Diff line change 1
1
#include " nix/store/s3-url.hh"
2
2
#include " nix/util/tests/gmock-matchers.hh"
3
3
4
- #if NIX_WITH_S3_SUPPORT
4
+ #if NIX_WITH_S3_SUPPORT || NIX_WITH_CURL_S3
5
5
6
6
# include < gtest/gtest.h>
7
7
# include < gmock/gmock.h>
Original file line number Diff line number Diff line change 1
1
#include " nix/store/aws-creds.hh"
2
2
3
- #if NIX_WITH_S3_SUPPORT
3
+ #if NIX_WITH_CURL_S3
4
4
5
5
# include < aws/crt/Types.h>
6
6
# include " nix/store/s3-url.hh"
Original file line number Diff line number Diff line change 2
2
// /@file
3
3
#include " nix/store/config.hh"
4
4
5
- #if NIX_WITH_S3_SUPPORT
5
+ #if NIX_WITH_CURL_S3
6
6
7
7
# include " nix/store/s3-url.hh"
8
8
# include " nix/util/error.hh"
Original file line number Diff line number Diff line change 2
2
// /@file
3
3
#include " nix/store/config.hh"
4
4
5
- #if NIX_WITH_S3_SUPPORT
5
+ #if NIX_WITH_S3_SUPPORT || NIX_WITH_CURL_S3
6
6
7
7
# include " nix/util/url.hh"
8
8
# include " nix/util/util.hh"
Original file line number Diff line number Diff line change @@ -164,6 +164,33 @@ if aws_s3.found()
164
164
endif
165
165
deps_other += aws_s3
166
166
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
+
167
194
subdir (' nix-meson-build-support/generate-header' )
168
195
169
196
generated_headers = []
Original file line number Diff line number Diff line change @@ -33,3 +33,10 @@ option(
33
33
value : ' /nix/var/log/nix' ,
34
34
description : ' path to store logs in for Nix' ,
35
35
)
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 10
10
boost ,
11
11
curl ,
12
12
aws-sdk-cpp ,
13
+ aws-crt-cpp ,
13
14
libseccomp ,
14
15
nlohmann_json ,
15
16
sqlite ,
25
26
withAWS ?
26
27
# Default is this way because there have been issues building this dependency
27
28
stdenv . hostPlatform == stdenv . buildPlatform && ( stdenv . isLinux || stdenv . isDarwin ) ,
29
+
30
+ withCurlS3 ? false ,
28
31
} :
29
32
30
33
let
@@ -64,7 +67,8 @@ mkMesonLibrary (finalAttrs: {
64
67
sqlite
65
68
]
66
69
++ 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 ;
68
72
69
73
propagatedBuildInputs = [
70
74
nix-util
@@ -74,6 +78,7 @@ mkMesonLibrary (finalAttrs: {
74
78
mesonFlags = [
75
79
( lib . mesonEnable "seccomp-sandboxing" stdenv . hostPlatform . isLinux )
76
80
( lib . mesonBool "embedded-sandbox-shell" embeddedSandboxShell )
81
+ ( lib . mesonEnable "curl-s3-store" withCurlS3 )
77
82
]
78
83
++ lib . optionals stdenv . hostPlatform . isLinux [
79
84
( lib . mesonOption "sandbox-shell" "${ busybox-sandbox-shell } /bin/busybox" )
Original file line number Diff line number Diff line change 1
1
#include " nix/store/s3-url.hh"
2
2
3
- #if NIX_WITH_S3_SUPPORT
3
+ #if NIX_WITH_S3_SUPPORT || NIX_WITH_CURL_S3
4
4
5
5
# include " nix/util/error.hh"
6
6
# include " nix/util/split.hh"
You can’t perform that action at this time.
0 commit comments