1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-20 01:09:37 +01:00

nix flake show: log attribute name that "must be a derivation"

I would run `nix flake show` on a flake than hit:

===
        ├───ihaskell: package 'ihaskell-wrapper'
        ├───ihaskell-96: package 'ihaskell-wrapper'
        ├───ihaskell-96-dev: package 'ghc-shell-for-ihaskell-0.10.4.0'
error: expected a derivation
===
and it is not obvious what package is the culprit here since nix stops
rightaway.


Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
This commit is contained in:
Matthieu Coudron 2023-08-27 00:29:05 +02:00 committed by teto
parent ef8218f2e3
commit ac9d2a5b06
2 changed files with 27 additions and 2 deletions

View file

@ -1303,8 +1303,10 @@ struct CmdFlakeShow : FlakeCommand, MixJSON
try {
if (visitor.isDerivation())
showDerivation();
else
throw Error("expected a derivation");
else {
auto name = visitor.getAttrPathStr(state->s.name);
logger->warn(fmt("%s is not a derivation", name));
}
} catch (IFDError & e) {
if (!json) {
logger->cout(