NixOS / NixOS/nix

nix-store --delete doesn't work on binary caches

Open
#1,968 14 comments 0 reactions 1 assignee View on GitHub

@shlevy is already working on this.

Since Apr 1, 2018.

cli feature
Dominant language
C++
Stars
17.7k
Forks
2k
Avg merge
1d 16h
Merged PRs (30d)
80

Description

Currently there is no real way to manage the size of a binary cache. The functionality required to enable this use case is NIX_REMOTE=file:///path/to/binary/cache nix-store --delete <path>, which currently returns: error: requested operation is not supported by store.

Not all of us who host nix channels and binary caches have infinite storage.

To implement this effectively, support for the operation nix-store --query --referrers will also have to be implemented for binary caches, since nix-store --delete needs to fail if you attempt to delete something that is referred to by another path in the store.

It seems like this should be really easy to implement: to implement --query --referrers, search for the path reference in all of the .narinfo files, and return the ones that contain it. To implement --delete, first check that there are no referrers, and then delete the .narinfo and the .nar if there are none.

I would implement this but I suck at writing C++.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.