Stream: nixos

Topic: Setting up personal caches using `attic`


view this post on Zulip Srid (Feb 13 2024 at 11:36):

[contd convo with @Andreas ]

I've been recommending people use nix run github:... for installing some of my software like Emanote, nixci, nix-health (especially as they are out-of-date on the increasingly unwieldy monorepo nixpkgs).

To that end, I want to setup a small package set without IFD, providing cache for Linux and mac.

I could expose the local nix store via nix-serve-ng, but https://github.com/zhaofengli/attic is probably the more reliable option down the line, especially for dealing with larger builds/caches (at work).

view this post on Zulip Andreas (Feb 13 2024 at 11:40):

Yes, I was thinking about using something like attic. That might be a neat thing. IIRC it also just acts as a kind of cache overlay on cache.nixos.org, so everything that is not in your specialized cache is just forwarded to the larger official one.

For setting this up you would need some hardware though I guess, and an S3 compatible storage provider of some kind. And I was wondering how much storage and bandwidth you might need for your existing Haskell packages.

view this post on Zulip Srid (Feb 13 2024 at 11:40):

I think attic supports local storage too, if you just want store them in local disk to begin with.

view this post on Zulip Srid (Feb 13 2024 at 11:41):

As for bandwidth, for my personal projects the 1 Gbits/s should probably be good enough to begin with.

view this post on Zulip Srid (Feb 13 2024 at 11:42):

Of course cache is useless without a CI that pushes to it. For this I've been exploring GitHub runners (topic here), and eventually want to set one up on my macbook as well.

view this post on Zulip Andreas (Feb 13 2024 at 11:43):

Yes it does support local storage. Which might be sufficient, right.

I was just wondering what happens to your storage if your machine goes down for whatever reason.

view this post on Zulip Srid (Feb 13 2024 at 11:43):

If store gets corrupt and recreated, just do a rebuild. There aren't a lot to rebuild.

view this post on Zulip Srid (Feb 13 2024 at 11:44):

Need to figure out a smart gcroot pinning system, that works with CI along with these 'recovery' instances.

view this post on Zulip Andreas (Feb 13 2024 at 11:49):

a smart gcroot pinning system

I am not quite sure I am following on this one

view this post on Zulip Srid (Feb 13 2024 at 11:50):

garbage collect everything but last N commits of stable (and desired) branches of repos.

view this post on Zulip Srid (Feb 13 2024 at 11:51):

https://github.com/hercules-ci/hercules-ci-agent/issues/482

view this post on Zulip Andreas (Feb 13 2024 at 12:00):

Maybe the attic tutorial https://docs.attic.rs/tutorial.html is interesting, too. It comes with some kind of garbage collection capabilities.

view this post on Zulip Tim DeHerrera (Feb 13 2024 at 14:37):

FWIW, for me, digitalocean spaces is super cheap ($5 p/m) and putting it behind cloudflare CDN is free. Also they allow an unlimited number of buckets so long as you don't go over 500G so you could have multiple caches if you wanted to

view this post on Zulip Srid (Feb 13 2024 at 14:42):

500G

Cloudflare R2? What did you get this number from?

view this post on Zulip Tim DeHerrera (Feb 13 2024 at 14:43):

Oh I guess I misremembered, it's 250G

view this post on Zulip Tim DeHerrera (Feb 13 2024 at 14:44):

(for $5)

view this post on Zulip Srid (Feb 13 2024 at 17:36):

Any reason why I shouldn't put the cache data on one of these? https://www.hetzner.com/storage/storage-box/

view this post on Zulip Andreas (Feb 13 2024 at 17:43):

Srid said:

Any reason why I shouldn't put the cache data on one of these? https://www.hetzner.com/storage/storage-box/

Do you have full SSH access to these? Not really, right. Not sure what you are planing but for attic is would probably be nice to get NixOS with Minio or something similar.


Last updated: Nov 15 2024 at 11:45 UTC