diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-04-06 14:56:13 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-04-06 14:56:13 +0200 |
commit | 68b43e01ddf990182c87a924d647dc7aa93b34f7 (patch) | |
tree | 4ca0b101c3f241aebe58f4fa4fa01dfd0eaeaee2 /src/nix | |
parent | ce3173edc15ad704c5083baba09b7bcdb99d5104 (diff) |
nix flake info: Show resolved URL
This is useful for finding out what a registry lookup resolves to, e.g
$ nix flake info patchelf
Resolved URL: github:NixOS/patchelf
Locked URL: github:NixOS/patchelf/cd7955af31698c571c30b7a0f78e59fd624d0229
Diffstat (limited to 'src/nix')
-rw-r--r-- | src/nix/flake.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc index 03bb9fe37..e79f4129a 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -80,7 +80,8 @@ struct CmdFlakeList : EvalCommand static void printFlakeInfo(const Store & store, const Flake & flake) { - std::cout << fmt("URL: %s\n", flake.lockedRef.to_string()); + std::cout << fmt("Resolved URL: %s\n", flake.resolvedRef.to_string()); + std::cout << fmt("Locked URL: %s\n", flake.lockedRef.to_string()); std::cout << fmt("Edition: %s\n", flake.edition); if (flake.description) std::cout << fmt("Description: %s\n", *flake.description); @@ -100,8 +101,11 @@ static nlohmann::json flakeToJson(const Store & store, const Flake & flake) if (flake.description) j["description"] = *flake.description; j["edition"] = flake.edition; - j["url"] = flake.lockedRef.to_string(); + j["originalUrl"] = flake.originalRef.to_string(); j["original"] = attrsToJson(flake.originalRef.toAttrs()); + j["resolvedUrl"] = flake.resolvedRef.to_string(); + j["resolved"] = attrsToJson(flake.resolvedRef.toAttrs()); + j["url"] = flake.lockedRef.to_string(); // FIXME: rename to lockedUrl j["locked"] = attrsToJson(flake.lockedRef.toAttrs()); j["info"] = flake.sourceInfo->info.toJson(); if (auto rev = flake.lockedRef.input->getRev()) |