Hello,
I don’t understand the definition of Import From Derivation from CppNix’s Documentation. It (version 2.33.4) says
Passing an expression
exprthat evaluates to a store path to any built-in function which reads from the filesystem constitutes Import From Derivation…
Here are some examples that confuses me (suppose that nixpkgs is in the store):
-
Angle bracket syntax path
Say that we have a<nixpkgs>in the NIX_PATH and I wish to access lib in it. I doimport <nixpkgs/lib>. -
Path concatenation
Say that I have a source managed withnivornpinsand I want to access lib in it. I doimport (sources.nixpkgs + "/lib"). -
Relative path in flake context
When evaluating a flake, the entire directory is copied to the store. I doimport ./someFileInFlake.nix. -
An attribute of a derivation
Say thatnixpkgsis fetched withfetchFromGitHub, which returns a derivation. I doimport (import nixpkgs {}).path {}(consider the outerimport. I suppose the inner one is IFD?)
In all scenarios I read into a nix expression in the store using import, so the expression I’m importing from technically depends on a derivation. But at the same time, they are path types, not derivations. They themselves (e.g. <nixpkgs/lib>) cannot be realised. Doing :b <nixpkgs/lib> in the repl will give you a
error:
expression does not evaluate to a derivation, so I can’t build it
Are they IFDs ?
Thank you for reading my question!