magic-nix-cache icon indicating copy to clipboard operation
magic-nix-cache copied to clipboard

feat: skip small files (<5KB)

Open hraban opened this issue 1 year ago • 5 comments

Totally arbitrary limit. Never programmed Rust so I have no idea if this work. Can't build it locally even using the nix from the flake.

Fixes https://github.com/DeterminateSystems/magic-nix-cache-action/issues/31 ?

hraban avatar May 22 '24 03:05 hraban

Thanks for the PR! I'll tag in @edolstra to see if this makes sense with the invariants of caches. One thing to note is this is really a proxy for how long the build takes, which is a bit more important.

grahamc avatar May 22 '24 12:05 grahamc

I'd be happy to test this ~locally~ in my project but I'm not sure how. I tried to use source-pr but it can't find the binary--I'm assuming it didn't get built because I'm unknown on this project? See https://github.com/hraban/cl-nix-lite/actions/runs/9185180443/job/25258704165

hraban avatar May 22 '24 13:05 hraban

I was able to build this on aarch64-darwin and x86_64-darwin using nix run https://flakehub.com/f/NixOS/nix/2.20.tar.gz -- build.

One thing to note is this is really a proxy for how long the build takes, which is a bit more important.

I've added this as a comment.

hraban avatar May 22 '24 20:05 hraban

@hraban I've added the upload to s3 label which will enable you to use source-pr (though you will need to ~~push another change here and~~ wait until the upload is complete, which takes a few minutes).

EDIT: actually no, that label only works that way for PRs opened in our org, so source-pr will not be available here.

lucperkins avatar May 22 '24 21:05 lucperkins

This seems like a solid solution, it would eliminate more than half the cache entries i get for my project and allow more use of actually useful cached items.

Maybe one thing is you could have the size limit able to be customised through an env variable during launch, eg (NAR_SIZE_LIMIT=2000) if a user finds that their project has a weird outlier that takes a while to create but the result is still small.

DaRacci avatar Dec 09 '24 03:12 DaRacci