mirror of
https://github.com/NixOS/nix.git
synced 2025-11-08 19:46:02 +01:00
Relegate toRealPath to LocalFSStore
Fix #14480 This method is not well-defined for arbitrary stores, which do not have a notion of a "real path" -- it is only well-defined for local file systems stores, which do have exactly that notion, and so it is moved to that sub-interface instead. Some call-sites had to be fixed up for this, but in all cases the changes are positive. Using `getFSSourceAccessor` allows for more other stores to work properly. `nix-channel` was straight-up wrong in the case of redirected local stores. And the building logic with remote building and a non-local store is also fixed, properly gating some deletions on store type. Co-authored-by: Robert Hensing <robert@roberthensing.nl>
This commit is contained in:
parent
948c89b367
commit
099af7578f
12 changed files with 63 additions and 55 deletions
|
|
@ -7,6 +7,7 @@
|
|||
#include "nix/store/store-api.hh"
|
||||
#include "nix/store/store-open.hh"
|
||||
#include "nix/store/build-result.hh"
|
||||
#include "nix/store/local-fs-store.hh"
|
||||
|
||||
#include "nix/store/globals.hh"
|
||||
|
||||
|
|
@ -109,7 +110,8 @@ nix_err nix_store_real_path(
|
|||
if (context)
|
||||
context->last_err_code = NIX_OK;
|
||||
try {
|
||||
auto res = store->ptr->toRealPath(path->path);
|
||||
auto store2 = store->ptr.dynamic_pointer_cast<nix::LocalFSStore>();
|
||||
auto res = store2 ? store2->toRealPath(path->path) : store->ptr->printStorePath(path->path);
|
||||
return call_nix_get_string_callback(res, callback, user_data);
|
||||
}
|
||||
NIXC_CATCH_ERRS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue