mirror of
https://github.com/NixOS/nix.git
synced 2025-11-21 01:39:36 +01:00
nix flake metadata: Show store path if available
This commit is contained in:
parent
d0a89fa03f
commit
f6ad6291ab
2 changed files with 7 additions and 2 deletions
|
|
@ -218,9 +218,13 @@ struct CmdFlakeMetadata : FlakeCommand, MixJSON
|
|||
auto lockedFlake = lockFlake();
|
||||
auto & flake = lockedFlake.flake;
|
||||
|
||||
/* Hack to show the store path if available. */
|
||||
std::optional<StorePath> storePath;
|
||||
if (flake.lockedRef.input.getNarHash())
|
||||
storePath = flake.lockedRef.input.computeStorePath(*store);
|
||||
if (store->isInStore(flake.path.path.abs())) {
|
||||
auto path = store->toStorePath(flake.path.path.abs()).first;
|
||||
if (store->isValidPath(path))
|
||||
storePath = path;
|
||||
}
|
||||
|
||||
if (json) {
|
||||
nlohmann::json j;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue