diff options
author | Ludovic Courtès <ludo@gnu.org> | 2023-11-10 21:37:28 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2023-12-11 23:18:53 +0100 |
commit | 1e47148f46e31eb99ce8ec7bc12232cf50d0ebec (patch) | |
tree | a2693022e88bc939e32b47671f8464d3ec3d4df0 /nix/nix-daemon | |
parent | b650dcabf1cd1aa596228e1e7eff4acf372ef6a6 (diff) | |
download | guix-1e47148f46e31eb99ce8ec7bc12232cf50d0ebec.tar.gz guix-1e47148f46e31eb99ce8ec7bc12232cf50d0ebec.zip |
daemon: Implement ‘substitute-urls’ RPC.
* nix/libstore/worker-protocol.hh (PROTOCOL_VERSION): Bump.
(WorkerOp): Add ‘wopSubstituteURLs’.
* nix/nix-daemon/nix-daemon.cc (performOp): Implement it.
* guix/store.scm (%protocol-version): Bump.
(operation-id): Add ‘substitute-urls’.
(substitute-urls): New procedure.
* tests/store.scm ("substitute-urls, default")
("substitute-urls, client-specified URLs")
("substitute-urls, disabled"): New tests.
Change-Id: I2c0119500c3a1eecfa5ebf32463ffb0f173161de
Diffstat (limited to 'nix/nix-daemon')
-rw-r--r-- | nix/nix-daemon/nix-daemon.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc index 497de11a04..4cb05c802e 100644 --- a/nix/nix-daemon/nix-daemon.cc +++ b/nix/nix-daemon/nix-daemon.cc @@ -736,6 +736,23 @@ static void performOp(bool trusted, unsigned int clientVersion, break; } + case wopSubstituteURLs: { + startWork(); + Strings urls; + if (settings.get("build-use-substitutes", std::string("false")) == "true") { + /* First check the client-provided substitute URLs, then those + passed to the daemon. */ + auto str = settings.get("untrusted-substitute-urls", std::string("")); + if (str.empty()) { + str = settings.get("substitute-urls", std::string("")); + } + urls = tokenizeString<Strings>(str); + } + stopWork(); + writeStrings(urls, to); + break; + } + default: throw Error(format("invalid operation %1%") % op); } |