nix icon indicating copy to clipboard operation
nix copied to clipboard

nix copy: allow excluding paths already in another cache

Open donn opened this issue 6 months ago • 0 comments

Is your feature request related to a problem?

What I assume is a fairly common use case for setting up caches is to only copy parts of the closure that are not already present in https://cache.nixos.org. Specifically, I want to copy a local store PATH to an s3:// target.

Some custom caching software including Cachix and Attic for example, have this set up by default. It allows caches to save storage space as I believe most users have cache.nixos.org configured.

Proposed solution

A new flag to exclude store paths already in a specified binary cache from copying. Similar to --substitute-on-destination, but the resolution is done on the source instead.

Alternative solutions

I thought of hacking together a solution, but the bug https://github.com/NixOS/nix/issues/12835 complicates things even further.

Additional context

This was previously proposed as https://github.com/NixOS/nix/issues/7527. No action was taken. The resolution to this issue is to use attic, which complicates a far simpler S3 + Cloudfront setup.

Checklist


Add :+1: to issues you find important.

donn avatar Jun 06 '25 11:06 donn