nickel-lang / organist

Control all your tooling from a single console
MIT License
361 stars 20 forks source link

organist.import_nix doesn't work with outputs from the current flake #186

Open mboes opened 5 months ago

mboes commented 5 months ago

Say you have a flake output called foo, such that the following works:

$ nix build .#foo

I would expect organist.import_nix ".#foo", say in a project.ncl, to evaluate to a Nix path. Actual:

error: Missing input "..foo"

This is despite the fact that https://github.com/nickel-lang/organist/blob/main/lib/nix-interop/derivation.ncl#L258-L262 claims:

This follows the same search rules as the nix build cli, namely that the library will consider the first valid values within:

  • InputPath
  • "packages".system.InputPath
  • "legacyPackages".system.InputPath
thufschmitt commented 5 months ago

Mh, I see how that comment can be misleading (and the error message a bit too, although that should be fixed by 7e6c7f8a1284e00da55d2d27bdc6890e48b9af1e).

The search rules are a purely Nix-language level thing, they don't interact with the command-line – and .#foo only makes sense at the command-line. The current flake is referred to as self in the language — so you want organist.import_nix "self#foo".

I'll try to improve the wording to make this more explicit

mboes commented 4 months ago

I see. Shows my ignorance of most things flakes. Like you say though, if the quality of diagnostics could be improved that would be great.