Skip to content

Commit d0fb03c

Browse files
authored
Merge pull request NixOS#14282 from NixOS/s3-cleanup
Simplify meson for S3 support via aws-crt-cpp
2 parents c847cd8 + ffbc33f commit d0fb03c

File tree

3 files changed

+9
-21
lines changed

3 files changed

+9
-21
lines changed

src/libstore/meson.build

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ boost = dependency(
113113
# put in `deps_other`.
114114
deps_other += boost
115115

116-
curl = dependency('libcurl', 'curl')
116+
curl = dependency('libcurl', 'curl', version : '>= 7.75.0')
117117
deps_private += curl
118118

119119
# seccomp only makes sense on Linux
@@ -142,27 +142,16 @@ deps_public += nlohmann_json
142142
sqlite = dependency('sqlite3', 'sqlite', version : '>=3.6.19')
143143
deps_private += sqlite
144144

145-
# Curl-based S3 store support
146-
# Check if curl supports AWS SigV4 (requires >= 7.75.0)
147-
curl_supports_aws_sigv4 = curl.version().version_compare('>= 7.75.0')
148-
# AWS CRT C++ for lightweight credential management
149-
aws_crt_cpp = cxx.find_library('aws-crt-cpp', required : false)
150-
151-
curl_s3_store_opt = get_option('curl-s3-store').require(
152-
curl_supports_aws_sigv4,
153-
error_message : 'curl-based S3 support requires curl >= 7.75.0',
154-
).require(
155-
aws_crt_cpp.found(),
156-
error_message : 'curl-based S3 support requires aws-crt-cpp',
157-
)
145+
s3_aws_auth = get_option('s3-aws-auth')
146+
aws_crt_cpp = cxx.find_library('aws-crt-cpp', required : s3_aws_auth)
158147

159-
if curl_s3_store_opt.enabled()
148+
if s3_aws_auth.enabled()
160149
deps_other += aws_crt_cpp
161150
aws_c_common = cxx.find_library('aws-c-common', required : true)
162151
deps_other += aws_c_common
163152
endif
164153

165-
configdata_pub.set('NIX_WITH_AWS_AUTH', curl_s3_store_opt.enabled().to_int())
154+
configdata_pub.set('NIX_WITH_AWS_AUTH', s3_aws_auth.enabled().to_int())
166155

167156
subdir('nix-meson-build-support/generate-header')
168157

@@ -346,7 +335,7 @@ sources = files(
346335
)
347336

348337
# AWS credentials code requires AWS CRT, so only compile when enabled
349-
if curl_s3_store_opt.enabled()
338+
if s3_aws_auth.enabled()
350339
sources += files('aws-creds.cc')
351340
endif
352341

src/libstore/meson.options

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ option(
3535
)
3636

3737
option(
38-
'curl-s3-store',
38+
's3-aws-auth',
3939
type : 'feature',
40-
value : 'disabled',
41-
description : 'Enable curl-based S3 binary cache store support (requires aws-crt-cpp and curl >= 7.75.0)',
40+
description : 'build support for AWS authentication with S3',
4241
)

src/libstore/package.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ mkMesonLibrary (finalAttrs: {
7575
mesonFlags = [
7676
(lib.mesonEnable "seccomp-sandboxing" stdenv.hostPlatform.isLinux)
7777
(lib.mesonBool "embedded-sandbox-shell" embeddedSandboxShell)
78-
(lib.mesonEnable "curl-s3-store" withAWS)
78+
(lib.mesonEnable "s3-aws-auth" withAWS)
7979
]
8080
++ lib.optionals stdenv.hostPlatform.isLinux [
8181
(lib.mesonOption "sandbox-shell" "${busybox-sandbox-shell}/bin/busybox")

0 commit comments

Comments
 (0)