nickel-lang/organist

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

Opened this issue · 2 comments

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

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

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

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.