You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Passing an expression `expr` that evaluates to a [store path](@docroot@/store/store-path.md) to any built-in function which reads from the filesystem constitutes Import From Derivation (IFD):
However, "an expression expr that evaluates to a store path" does not necessarily involve a derivation. It may also be produced by a built-in fetcher.
Nix also agrees that builtins.fetchurl is not IFD:
$ nix eval -f example.nix --no-allow-import-from-derivation viaPkgs
error:
… while calling the 'readFile' builtin
at /tmp/tmp.sjf6pjcR2J/example.nix:12:13:
11| });
12| viaPkgs = builtins.readFile (pkgs.fetchurl {
| ^
13| inherit name url sha256;
… while realising the context of path '/nix/store/ppsywqzjm5v8nvki3swzx4zrri55ppcp-funny.txt'
error: cannot build '/nix/store/5x8v83jldidwrn9vg8w9wr9y2r3x04p4-funny.txt.drv^out' during evaluation because the option 'allow-import-from-derivation' is disabled
$ nix eval -f example.nix --no-allow-import-from-derivation viaBuiltins
"[html content of example.com]"
Proposal
The paragraph should somehow mention that it's only IFD when the store path is produced by a derivation. The existing sentence is already pretty long and complex, so maybe using a list would make it easier to understand:
Import From Derivation (IFD) occurs when:
an expression expr, which evaluates to a store path
is passed to any built-in function which reads from the filesystem
and the store path in question is an output path of a derivation
The following are built-in functions reading from the filesystem:
Problem
The manual entry states:
nix/doc/manual/src/language/import-from-derivation.md
Line 7 in 4e8a9e0
However, "an expression
expr
that evaluates to a store path" does not necessarily involve a derivation. It may also be produced by a built-in fetcher.Nix also agrees that
builtins.fetchurl
is not IFD:Proposal
The paragraph should somehow mention that it's only IFD when the store path is produced by a derivation. The existing sentence is already pretty long and complex, so maybe using a list would make it easier to understand:
Import From Derivation (IFD) occurs when:
expr
, which evaluates to a store pathThe following are built-in functions reading from the filesystem:
(the existing list of functions)
Checklist
Priorities
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: