Skip to content

Conversation

lovesegfault
Copy link
Member

Motivation

#13084

Context

Early days, just making a draft for visibility and CI


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@xokdvium
Copy link
Contributor

Would it be conceivable to just outright replace aws-sdk-cpp with this? I don't think we'd want to support it if we land this eventually.

@lovesegfault
Copy link
Member Author

I was unsure about just removing the existing implementation outright, but I can do that if folks are OK with it?

@xokdvium
Copy link
Contributor

but I can do that if folks are OK with it?

Can't speak for everyone, but I feel ripping out aws-sdk-cpp would be very welcome if the new thing is more lightweight and reuses the curl infrastructure with feature parity. That would definitely be better than supporting both implementations.

@lovesegfault
Copy link
Member Author

@xokdvium I'm going to get this in a fully working state, and after I'm happy with it I'll tack on a final commit removing the old impl, so if there's tension we can discuss that point separately, or I can make it a separate PR, etc.

I'm with you that if this works well, we're better off just tossing the old impl, though that would mean folks building with old curl would lose the ability to talk to s3, but idk if we care to support people building non-standard configurations like that.

@github-actions github-actions bot added the store Issues and pull requests concerning the Nix store label Aug 14, 2025
@lovesegfault lovesegfault force-pushed the curl-based-s3-v2 branch 2 times, most recently from 2030275 to 86873ed Compare August 14, 2025 23:40
@Mic92
Copy link
Member

Mic92 commented Aug 15, 2025

I want to definitely test this with our hydra staging instance to ensure it still can upload stuff to s3 buckets before merging.

@lovesegfault
Copy link
Member Author

AFAICT this is ready for (very) preliminary testing; at least I was able to pull and push to an S3 store and auth just worked, like magic :)

@lovesegfault
Copy link
Member Author

Nevermind, I messed something up, buckets outside of us-east-1 don't work :P

@lovesegfault lovesegfault force-pushed the curl-based-s3-v2 branch 3 times, most recently from aefcffd to 3433232 Compare August 15, 2025 20:33
@lovesegfault lovesegfault force-pushed the curl-based-s3-v2 branch 3 times, most recently from 2dd60ad to 80e3327 Compare August 17, 2025 04:17
@lovesegfault lovesegfault marked this pull request as ready for review August 17, 2025 04:37
@lovesegfault lovesegfault requested review from Mic92 and xokdvium August 17, 2025 04:37
Copy link
Contributor

@xokdvium xokdvium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some preliminary comments

rehank0678

This comment was marked as spam.

rehank0678

This comment was marked as spam.

Ericson2314 added a commit to obsidiansystems/nix that referenced this pull request Aug 25, 2025
This allows us to replace some very hacky and not correct string
concatentation in `HttpBinaryCacheStore`. It will especially be useful
with NixOS#13752, when today's hacks started to cause problems in practice,
not just theory.

Also make `fixGitURL` returned a `ParsedURL`.
lovesegfault added a commit to lovesegfault/nix that referenced this pull request Aug 25, 2025
This is extracted from the work in NixOS#13752
lovesegfault added a commit to lovesegfault/nix that referenced this pull request Aug 25, 2025
This is extracted from the work in NixOS#13752
lovesegfault added a commit to lovesegfault/nix that referenced this pull request Aug 25, 2025
This is extracted from the work in NixOS#13752
lovesegfault added a commit to lovesegfault/nix that referenced this pull request Aug 25, 2025
This is extracted from the work in NixOS#13752
lovesegfault added a commit to lovesegfault/nix that referenced this pull request Aug 25, 2025
This is extracted from the work in NixOS#13752
lovesegfault added a commit to lovesegfault/nix that referenced this pull request Aug 25, 2025
This is extracted from the work in NixOS#13752
Ericson2314 added a commit to obsidiansystems/nix that referenced this pull request Aug 25, 2025
This allows us to replace some very hacky and not correct string
concatentation in `HttpBinaryCacheStore`. It will especially be useful
with NixOS#13752, when today's hacks started to cause problems in practice,
not just theory.

Also make `fixGitURL` returned a `ParsedURL`.
Ericson2314 added a commit to obsidiansystems/nix that referenced this pull request Aug 25, 2025
This allows us to replace some very hacky and not correct string
concatentation in `HttpBinaryCacheStore`. It will especially be useful
with NixOS#13752, when today's hacks started to cause problems in practice,
not just theory.

Also make `fixGitURL` returned a `ParsedURL`.
{
// Access the curlFileTransfer singleton and clear its cache
try {
auto ft = getFileTransfer();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not work as expected in builtin derivaiton fetching, because it doesn't use getFileTransfer in that case because it is in a fork.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, those would each end up with their own provider. I couldn't see a clean way to improve that though, and AFAICT the status-quo also does that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a test though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#13791 (comment) This comment was supposed to go with this PR. It might be a pain, but it looks like if we keep on following the definitions of these global AWS functions, eventually we can avoid global state and fork problems, while still using public things.

Ericson2314 added a commit to obsidiansystems/nix that referenced this pull request Aug 25, 2025
This allows us to replace some very hacky and not correct string
concatentation in `HttpBinaryCacheStore`. It will especially be useful
with NixOS#13752, when today's hacks started to cause problems in practice,
not just theory.

Also make `fixGitURL` returned a `ParsedURL`.
Ericson2314 added a commit to obsidiansystems/nix that referenced this pull request Aug 25, 2025
This allows us to replace some very hacky and not correct string
concatentation in `HttpBinaryCacheStore`. It will especially be useful
with NixOS#13752, when today's hacks started to cause problems in practice,
not just theory.

Also make `fixGitURL` returned a `ParsedURL`.
Ericson2314 added a commit to obsidiansystems/nix that referenced this pull request Aug 25, 2025
This allows us to replace some very hacky and not correct string
concatentation in `HttpBinaryCacheStore`. It will especially be useful
with NixOS#13752, when today's hacks started to cause problems in practice,
not just theory.

Also make `fixGitURL` returned a `ParsedURL`.
Ericson2314 added a commit to obsidiansystems/nix that referenced this pull request Aug 26, 2025
This allows us to replace some very hacky and not correct string
concatentation in `HttpBinaryCacheStore`. It will especially be useful
with NixOS#13752, when today's hacks started to cause problems in practice,
not just theory.

Also make `fixGitURL` returned a `ParsedURL`.
Ericson2314 added a commit to obsidiansystems/nix that referenced this pull request Aug 26, 2025
This allows us to replace some very hacky and not correct string
concatentation in `HttpBinaryCacheStore`. It will especially be useful
with NixOS#13752, when today's hacks started to cause problems in practice,
not just theory.

Also make `fixGitURL` returned a `ParsedURL`.
Ericson2314 added a commit to obsidiansystems/nix that referenced this pull request Aug 26, 2025
This allows us to replace some very hacky and not correct string
concatentation in `HttpBinaryCacheStore`. It will especially be useful
with NixOS#13752, when today's hacks started to cause problems in practice,
not just theory.

Also make `fixGitURL` returned a `ParsedURL`.
Ericson2314 added a commit to obsidiansystems/nix that referenced this pull request Aug 26, 2025
This allows us to replace some very hacky and not correct string
concatentation in `HttpBinaryCacheStore`. It will especially be useful
with NixOS#13752, when today's hacks started to cause problems in practice,
not just theory.

Also make `fixGitURL` returned a `ParsedURL`.
Ericson2314 added a commit to obsidiansystems/nix that referenced this pull request Aug 26, 2025
This allows us to replace some very hacky and not correct string
concatentation in `HttpBinaryCacheStore`. It will especially be useful
with NixOS#13752, when today's hacks started to cause problems in practice,
not just theory.

Also make `fixGitURL` returned a `ParsedURL`.
Ericson2314 added a commit to obsidiansystems/nix that referenced this pull request Aug 26, 2025
This allows us to replace some very hacky and not correct string
concatentation in `HttpBinaryCacheStore`. It will especially be useful
with NixOS#13752, when today's hacks started to cause problems in practice,
not just theory.

Also make `fixGitURL` returned a `ParsedURL`.
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: NixOS#13084, NixOS#12671, NixOS#11748, NixOS#12403, NixOS#5947
@@ -1,3 +1,5 @@
#pragma once
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#pragma once
#pragma once
///@file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we can land this one write away, just to chip things off to shrink the diff

Comment on lines +145 to +152
if not aws_crt_cpp.found()
# Fallback: try pkg-config with different name
aws_crt_cpp = dependency('libaws-crt-cpp', required : false)
endif
if not aws_crt_cpp.found()
# Fallback: try to find library manually
aws_crt_cpp = cxx.find_library('aws-crt-cpp', required : false)
endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it in practice fucked up like this? I would hope not! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation store Issues and pull requests concerning the Nix store with-tests Issues related to testing. PRs with tests have some priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants