Is there something like nix copy that only realizes things in the --from store if they are not present in the --to store? My application is a CI runner whose job is to populate a binary cache.
It doesn’t need to have the packages locally, just needs to copy/build the new ones to put them in the binary cache. I can achieve the same thing with
OUTPATH=$(nix eval --raw ".#p.outPath");
if ! nix store ls --store 'https://mybinarycache.example.com' "${OUTPATH}"; then
nix copy -L --to 'https://mybinarycache.example.com' ".#p"
fi
but then I pay the evaluation costs twice in the uncached case.