Nix/NixOS S3 Update and Recap of Community Call
discourse.nixos.org
discourse.nixos.org
> It's wild to me that the monthly cost of the #NixOS cache infrastructure could fund the entire Arch Linux infrastructure costs for a year.
> It's 6 times the amount Arch get in monthly donations, and ~4 times Debian gets in monthly donations.
Unlike Arch it also is not a rolling release package repository and has both unstable and stable branches that it needs to maintain (along with different versions for each). In fact, the NixOS cache keeps every version of every package that has ever been built and stored in the cache so that binary versions of all historical package versions are available.
Finally it also includes packages for MacOS binaries as well as Linux ones.
I'm frankly surprised it actually costs as little as it does given that it's using pretty expensive S3 storage for everything.
This is something that tens of thousands of engineers are getting huge value from in their daily life. I know this is a pretty common problem in the open source world, but it still sucks to see.
Hard drive cost $/B continue to fall: https://www.backblaze.com/blog/hard-drive-cost-per-gigabyte/
Self-hosting is looking more and more attractive.
There are still lots of reasons to consider alternative hosting providers (the biggest one: egress) but that blog post--frequently reposted and annoyingly misleading--is not a good summary of the situation here.
Bad example. "Latency", if it can even be called that, is 12-48 hours.
It's not cloud storage, it's archiving.
I wish they were less concerned with where they artifacts are stored and more about how nixpkg can prove they are authentic and who authored them.
Nix has so many innovations over other other distributions but the massive step backwards in supply chain integrity still makes it too dangerous to use for any system you would not trust strangers with ssh access to.
Supply chain security is of course a massively multifaceted technical and social problem, but I’m curious what other distributions you think are doing it better in practice?
Also no signed commits or signed authorship means someone with Github access can just fake history and inject whatever they want after code reviews are completed, which will then be blindly and automatically signed.
Some of the people with write access to the nixpgs repo even have SMS recovery enabled on their github recovery email accounts. One sim swap to compromise all nix users. I will not call them out, but go try to do a email password reset on recent committers for yourself. A malicious github employee could also of course do whatever they want to an unsigned repo. Or a well placed BGP attack. Lots of options. It is hard to prevent such things, but author commit signing would mitigate the risk and can be enforced.
I made my case for this to the nix team but in the end it was concluded people would stop maintaining packages if they had to do the bare minimum like commit signing or hardware 2FA. https://github.com/NixOS/rfcs/pull/34
All this is fine, but it means effectively a decision was made for NixOS to be a hobby distro not suitable for any targeted applications or individuals. It really sucks, because I love everything else about nix design.
Instead I am forced to bootstrap high security applications using arch and debian toolchains which are worse than nix in every way but supply chain integrity given that all authors directly sign package sources with their personal well verified keys. They have a ton of other security and even their own supply chain problems but they at least can survive phishing, a malicious mirror, or a sim swap. It is a low bar nix sadly does not meet.
But the way I understand it, the current trust model is no different than any other package manager, so this hardly seems like a fair criticism.
Compare to arch, fedora, debian, and basically every other linux distro that has existed more than a decade. Every maintainer signs their own contributions with well known keys so they cannot be impersonated and so later stages of the supply chain cannot tamper with them.
Newer distros like Nix and Alpine decided do get rid of all that security overhead in order to attract a huge pile of randos as maintainers. I mean, it worked, but at a very high price.
How can anyone know the Hydra signing key was not tampered with?
These are problems other linux distros have solved for decades by just requiring maintainers press a blinking yubikey or similar to sign their contributions.
The problem is that the base data is substantial (425 TiB) and expensive to store on S3. Just mirroring the base data would not change this. Some sort of way to distribute the 425 TiB among multiple hosts/etc might help, but seems like that would be really complicated to manage reliably—much harder than finding a new sponsor or moving off S3 to some more efficient alternative.
Cloudflares R2 storage charges 0 cents out per gigabyte.
I don’t know how they do it.
We were looking to migrate a small photo service over to Cloudflare workers and R2 storage, partly because of the Bandwidth Alliance, but squashed that when we heard there might be surprise charges.
I can't speak to the overall health of the alliance, though. I remember reaching out to one of their listed partners (I forget which) in the Alliance a couple of years ago about the egress fee for bandwidth originating from Cloudflare, and the response I got was "we can talk about that when your fees get huge". That wasn't the response I was expecting from a partner.
I just clicked on one of the listed partners [2[ and the page still says "all bandwidth between Vultr and Cloudflare will be free of charge in the upcoming months." The Wayback Machine tells me that that statement hasn't been updated ever since it was created.
So without a clear number or scale, customers are still at the mercy of a call to the partner's Sales dept.
[0]: https://blog.cloudflare.com/bandwidth-alliance/
[1]: https://www.cloudflare.com/bandwidth-alliance/
[2]: https://www.cloudflare.com/partners/technology-partners/vult...
9 cents per GB is still a lot more than it needs to be. It's a form of vendor lock-in. BunnyCDN charges[1] 1 to 6 cents per GB depending on the region, or 0.5 cents and lower for the "volume network" with fewer POPs. They've done so for years, and it funded their entire operation until their first investment round last October.
Wow, I suppose this was bound to happen eventually, but LogicBlox built their entire prod infra on NixOS a decade ago.
Guess they didn't see the value in continuing to use such a niche distro.
[1]: https://discourse.nixos.org/t/nixos-foundations-financial-su...
yeah, there will be maintenance and setup work, but we've (web software engineers) developed a weirdly extreme fear of self hosting, even in cases where we're being killed on transfer costs
I shouldn't say "easily affordable" like anyone can afford it, but rather something that you can do with off the shelf retail components (within the budget of a hobbyist software engineer, anyway)
it's cheap compared to hobbies like driving a sports car, at least!
I've also had much better luck with connectivity, transfer speeds, and latency, for clients in some regions, with AWS than with some other hosts (e.g. Digital Ocean). It seems peering agreement quality really matters. Not sure how the big physical server hosts fare on that front vs. AWS (which is basically the gold standard, as far as I can tell) and it's hard to find such info without trying and seeing what happens. This matters if you're trying to serve a large audience over much of the Earth. The easy single-server solution might well see some clients lost 95% of their transfer speed from your service, or not be able to connect at all, compared with AWS.
there is just no reality where you build your own service for this with better reliability, less management, and less maintenance than s3 (and when i say s3 i’m including all managed object stores).
pointing at hetzner and saying, “look how cheap this is”, is missing the point.
I'm glad to see their short and long-term plan will probably involve a subsidized professional block storage service. I think that's the right move.
> ... and potential for replacing Fastly.
As far as i can tell from this and previous post - mix cache isn't using Fastly?
Tangentially, if they self hosted using say ZFS would the cached artifacts and other such things be candidates for the dedup features of the file system?
Their current sponsor isn’t a deep pocketed publicly traded cloud provider. All of these cloud providers advocate for open source. Cloudflare could come in and cover these costs and write them off as donations or something similar. For AWS they’d probably not even make a material difference in the accounting software.
I think you’ve got some deep seated angst against the Uber wealthy (join the club) but I never mentioned bezos. I mentioned these companies sponsoring selfishly for the goodwill it would bring.
I’ll try to make my case better next time.
> AWS S3 - We have been in contact with AWS throughout the week and awaiting a response to meet with the OSS team.
Yes, block-level deduplication would be hugely beneficial. If you're running Nix locally you can set auto-optimise-store = true, which enables file-level deduplication using hardlinks; that already saves a great deal of space.
Its possible to serve a nix cache directly out of a nix store, creating the NAR archives on-the-fly. But that would require a) a big filesystem and b) a lot more compute.
Which are not insurmountable challenges, but they are challenges.
It seems to work well for us, but I am curious how that would look at 425TB scale— would filesystem deduplication pay for the losses in compression, and if so, by how much? How does that change if you start sharding the store across multiple ZFS hosts?
If you were just storing a static set of pregenerated NAR archives, you will not see any benefit from filesystem-provided compression or deduplication.
If you host a live nix store (i.e. uncompressed files under /nix/store), then you could benefit from filesystem-provided compression and deduplication. Also, nix itself can replace duplicates with hard links. But the downside is then that you have to generate the NAR archives on the fly when a client requests a derivation.
That might be worth it, especially since they get great hit rates from Fastly. But on the other hand, that means a lot more moving parts to maintain and monitor vs. simple blob storage.
Then put whatever cache you want in front.
[1]: Ran into https://github.com/aristanetworks/nix-serve-ng/issues/19 with it
in this case, the files being stored are compressed archives (NAR files) so the block-level dedupe that ZFS does would probably find very little to work with, because the duplicated content would be at different offsets within each archive.
beyond that, there's also the issue that they would need a single ZFS pool with 500TB+ of storage (given the current ~425TB size). that's certainly doable with ZFS, but the hardware needed for that server would be...non-trivial. and of course that's just a single host, they would want multiple of those servers for redundancy. distributed object storage like S3 is a much better fit for that volume of data.
0: https://www.truenas.com/docs/references/zfsdeduplication/#co...