zhaofengli / attic

Multi-tenant Nix Binary Cache

Home Page:https://docs.attic.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document full cache option

jpds opened this issue · comments

The tutorial states in the pushing section:

The interesting thing is that attic automatically skipped over store paths cached by cache.nixos.org! This behavior can be configured on a per-cache basis.

However, I'm interesting in using attic which everything is pushed up to the cache so that everything is pulled down from the LAN without having to reach out to the Internet.

I've tried setting my local cache to have a higher priority of 30 than the cache.nixos.org 40 value. However, my test machine would still pull from there.

The only way I've found to force a client to use the local cache is to comment out the substituters line to be:

substituters = http://localhost:8080/hello #https://cache.nixos.org

...however I'm not sure if this would break anything else.

It should be as simple as setting the upstream cache keys to an empty string, either when you create the cache with attic cache create name --upstream-cache-key-name '', or after you've created the cache with attic cache configure name --upstream-cache-key-name ''. At that point, as long as your cache appears before cache.nixos.org in the substituters list, it should only use your local cache except when it doesn't have a path.

Yes, it should be. However nix has a cache of substituters priorities that has I think one week of TTL. Your option is that case is to go and directly delete that entry in the nix sqlite database.