Skip to content

Commit 3224636

Browse files
committed
refactor(libstore): rename NIX_WITH_S3_SUPPORT to NIX_WITH_AWS_AUTH
The macro now accurately reflects its purpose: gating only AWS authentication code, not all S3 functionality. S3 URL parsing, store configuration, and public bucket access work regardless of this flag. This rename clarifies that: - S3 support is always available (URL parsing, store registration) - Only AWS credential resolution requires the flag - The flag controls AWS CRT SDK dependency, not S3 protocol support
1 parent bb1f22a commit 3224636

File tree

9 files changed

+19
-19
lines changed

9 files changed

+19
-19
lines changed

src/libstore/aws-creds.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "nix/store/aws-creds.hh"
22

3-
#if NIX_WITH_S3_SUPPORT
3+
#if NIX_WITH_AWS_AUTH
44

55
# include <aws/crt/Types.h>
66
# include "nix/store/s3-url.hh"

src/libstore/builtins/fetchurl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static void builtinFetchurl(const BuiltinBuilderContext & ctx)
4141
FileTransferRequest request(VerbatimURL{url});
4242
request.decompress = false;
4343

44-
#if NIX_WITH_S3_SUPPORT
44+
#if NIX_WITH_AWS_AUTH
4545
// Use pre-resolved credentials if available
4646
if (ctx.awsCredentials && request.uri.scheme() == "s3") {
4747
debug("[pid=%d] Using pre-resolved AWS credentials from parent process", getpid());

src/libstore/filetransfer.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "store-config-private.hh"
1111
#include "nix/store/s3-url.hh"
1212
#include <optional>
13-
#if NIX_WITH_S3_SUPPORT
13+
#if NIX_WITH_AWS_AUTH
1414
# include "nix/store/aws-creds.hh"
1515
#endif
1616

@@ -435,7 +435,7 @@ struct curlFileTransfer : public FileTransfer
435435
}
436436
}
437437

438-
#if NIX_WITH_S3_SUPPORT
438+
#if NIX_WITH_AWS_AUTH
439439
// Set up AWS SigV4 signing if this is an S3 request
440440
// Note: AWS SigV4 support guaranteed available (curl >= 7.75.0 checked at build time)
441441
// The username/password (access key ID and secret key) are set via the general
@@ -874,7 +874,7 @@ void FileTransferRequest::setupForS3()
874874
// Update the request URI to use HTTPS (works without AWS SDK)
875875
uri = parsedS3.toHttpsUrl();
876876

877-
#if NIX_WITH_S3_SUPPORT
877+
#if NIX_WITH_AWS_AUTH
878878
// Auth-specific code only compiled when AWS support is available
879879
awsSigV4Provider = "aws:amz:" + parsedS3.region.value_or("us-east-1") + ":s3";
880880

src/libstore/include/nix/store/aws-creds.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
///@file
33
#include "nix/store/config.hh"
44

5-
#if NIX_WITH_S3_SUPPORT
5+
#if NIX_WITH_AWS_AUTH
66

77
# include "nix/store/s3-url.hh"
88
# include "nix/util/error.hh"

src/libstore/include/nix/store/builtins.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "nix/store/derivations.hh"
55
#include "nix/store/config.hh"
66

7-
#if NIX_WITH_S3_SUPPORT
7+
#if NIX_WITH_AWS_AUTH
88
# include "nix/store/aws-creds.hh"
99
#endif
1010

@@ -18,7 +18,7 @@ struct BuiltinBuilderContext
1818
std::string caFileData;
1919
Path tmpDirInSandbox;
2020

21-
#if NIX_WITH_S3_SUPPORT
21+
#if NIX_WITH_AWS_AUTH
2222
/**
2323
* Pre-resolved AWS credentials for S3 URLs in builtin:fetchurl.
2424
* When present, these should be used instead of creating new credential providers.

src/libstore/include/nix/store/filetransfer.hh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "nix/util/url.hh"
1313

1414
#include "nix/store/config.hh"
15-
#if NIX_WITH_S3_SUPPORT
15+
#if NIX_WITH_AWS_AUTH
1616
# include "nix/store/aws-creds.hh"
1717
#endif
1818
#include "nix/store/s3-url.hh"
@@ -114,7 +114,7 @@ struct FileTransferRequest
114114
* When provided, these credentials will be used with curl's CURLOPT_USERNAME/PASSWORD option.
115115
*/
116116
std::optional<UsernameAuth> usernameAuth;
117-
#if NIX_WITH_S3_SUPPORT
117+
#if NIX_WITH_AWS_AUTH
118118
/**
119119
* Pre-resolved AWS session token for S3 requests.
120120
* When provided along with usernameAuth, this will be used instead of fetching fresh credentials.
@@ -136,7 +136,7 @@ struct FileTransferRequest
136136
private:
137137
friend struct curlFileTransfer;
138138
void setupForS3();
139-
#if NIX_WITH_S3_SUPPORT
139+
#if NIX_WITH_AWS_AUTH
140140
std::optional<std::string> awsSigV4Provider;
141141
#endif
142142
};

src/libstore/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ if curl_s3_store_opt.enabled()
160160
deps_other += aws_crt_cpp
161161
endif
162162

163-
configdata_pub.set('NIX_WITH_S3_SUPPORT', curl_s3_store_opt.enabled().to_int())
163+
configdata_pub.set('NIX_WITH_AWS_AUTH', curl_s3_store_opt.enabled().to_int())
164164

165165
subdir('nix-meson-build-support/generate-header')
166166

src/libstore/unix/build/derivation-builder.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#include "store-config-private.hh"
4747
#include "build/derivation-check.hh"
4848

49-
#if NIX_WITH_S3_SUPPORT
49+
#if NIX_WITH_AWS_AUTH
5050
# include "nix/store/aws-creds.hh"
5151
# include "nix/store/s3-url.hh"
5252
# include "nix/util/url.hh"
@@ -296,7 +296,7 @@ class DerivationBuilderImpl : public DerivationBuilder, public DerivationBuilder
296296
*/
297297
virtual void startChild();
298298

299-
#if NIX_WITH_S3_SUPPORT
299+
#if NIX_WITH_AWS_AUTH
300300
/**
301301
* Pre-resolve AWS credentials for S3 URLs in builtin:fetchurl.
302302
* This should be called before forking to ensure credentials are available in child.
@@ -359,7 +359,7 @@ class DerivationBuilderImpl : public DerivationBuilder, public DerivationBuilder
359359
*/
360360
struct RunChildArgs
361361
{
362-
#if NIX_WITH_S3_SUPPORT
362+
#if NIX_WITH_AWS_AUTH
363363
std::optional<AwsCredentials> awsCredentials;
364364
#endif
365365
};
@@ -945,7 +945,7 @@ void DerivationBuilderImpl::openSlave()
945945
throw SysError("cannot pipe standard error into log file");
946946
}
947947

948-
#if NIX_WITH_S3_SUPPORT
948+
#if NIX_WITH_AWS_AUTH
949949
std::optional<AwsCredentials> DerivationBuilderImpl::preResolveAwsCredentials()
950950
{
951951
if (drv.isBuiltin() && drv.builder == "builtin:fetchurl") {
@@ -974,7 +974,7 @@ std::optional<AwsCredentials> DerivationBuilderImpl::preResolveAwsCredentials()
974974
void DerivationBuilderImpl::startChild()
975975
{
976976
RunChildArgs args{
977-
#if NIX_WITH_S3_SUPPORT
977+
#if NIX_WITH_AWS_AUTH
978978
.awsCredentials = preResolveAwsCredentials(),
979979
#endif
980980
};
@@ -1255,7 +1255,7 @@ void DerivationBuilderImpl::runChild(RunChildArgs args)
12551255
BuiltinBuilderContext ctx{
12561256
.drv = drv,
12571257
.tmpDirInSandbox = tmpDirInSandbox(),
1258-
#if NIX_WITH_S3_SUPPORT
1258+
#if NIX_WITH_AWS_AUTH
12591259
.awsCredentials = args.awsCredentials,
12601260
#endif
12611261
};

src/libstore/unix/build/linux-derivation-builder.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ struct ChrootLinuxDerivationBuilder : ChrootDerivationBuilder, LinuxDerivationBu
277277
void startChild() override
278278
{
279279
RunChildArgs args{
280-
# if NIX_WITH_S3_SUPPORT
280+
# if NIX_WITH_AWS_AUTH
281281
.awsCredentials = preResolveAwsCredentials(),
282282
# endif
283283
};

0 commit comments

Comments
 (0)