nix-community / lorri

Your project’s nix-env [maintainer=@Profpatsch,@nyarly]
Apache License 2.0
677 stars 24 forks source link

Better error message if a `buildInput` is not a drv #44

Open Profpatsch opened 3 years ago

Profpatsch commented 3 years ago

When I you lorri init and add a packageset to the buildInputs instead of a drv, e.g. pkgs.eclipses, the resulting error message is very bad:

{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {
  buildInputs = [
    pkgs.hello
    pkgs.eclipses
  ];
}

=>

…
LogLine("error: cannot coerce a set to a string, at /home/philip/.cache/lorri/cas/3a83fbad2f114b4f4f431db2014c985c:40:7"), LogLine("(use \'--show-trace\' to show detailed location information)")] } })

It comes out of our own nix file, so I’m pretty certain we can add a check that throws a better error message.

roberth commented 3 years ago

You'll want to do this for at least nativeBuildInputs.

buildInputs isn't quite suitable for developer tools, build tools and such. Such a shell will break with strictDeps.