1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-18 16:29:36 +01:00

Merge pull request #80 from DeterminateSystems/copy-sigs

nix store copy-sigs: Use http-connections setting to control parallelism
This commit is contained in:
Graham Christensen 2025-06-02 10:26:04 +00:00 committed by GitHub
commit 44bdb74c62
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 39 additions and 1 deletions

View file

@ -3,6 +3,7 @@
#include "nix/main/shared.hh"
#include "nix/store/store-open.hh"
#include "nix/util/thread-pool.hh"
#include "nix/store/filetransfer.hh"
#include <atomic>
@ -28,6 +29,13 @@ struct CmdCopySigs : StorePathsCommand
return "copy store path signatures from substituters";
}
std::string doc() override
{
return
#include "store-copy-sigs.md"
;
}
void run(ref<Store> store, StorePaths && storePaths) override
{
if (substituterUris.empty())
@ -38,7 +46,7 @@ struct CmdCopySigs : StorePathsCommand
for (auto & s : substituterUris)
substituters.push_back(openStore(s));
ThreadPool pool;
ThreadPool pool{fileTransferSettings.httpConnections};
std::atomic<size_t> added{0};

View file

@ -0,0 +1,30 @@
R""(
# Examples
* To copy signatures from a binary cache to the local store:
```console
# nix store copy-sigs --substituter https://cache.nixos.org \
--recursive /nix/store/y1x7ng5bmc9s8lqrf98brcpk1a7lbcl5-hello-2.12.1
```
* To copy signatures from one binary cache to another:
```console
# nix store copy-sigs --substituter https://cache.nixos.org \
--store file:///tmp/binary-cache \
--recursive -v \
/nix/store/y1x7ng5bmc9s8lqrf98brcpk1a7lbcl5-hello-2.12.1
imported 2 signatures
```
# Description
`nix store copy-sigs` copies store path signatures from one store to another.
It is not advised to copy signatures to binary cache stores. Binary cache signatures are stored in `.narinfo` files. Since these are cached aggressively, clients may not see the new signatures quickly. It is therefore better to set any required signatures when the paths are first uploaded to the binary cache.
Store paths are processed in parallel. The amount of parallelism is controlled by the [`http-connections`](@docroot@/command-ref/conf-file.md#conf-http-connections) settings.
)""