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,
to any built-in function which reads from the filesystem,
constitutes Import From Derivation (IFD):
import expr
.. other builtin functions that reads from the file system ..
It also says:
When the store path needs to be accessed, evaluation will be paused,
the corresponding store object realised, and then evaluation resumed.
Counter example:
nix-repl> pkgs = import <nixpkgs> {}
nix-repl> builtins.toString pkgs.zxing-cpp
"/nix/store/nvis47j5sxwibkwh0p94iwi4cx8rphgi-zxing-cpp-1.4.0"
# Try to import the path
nix-repl> import "/nix/store/nvis47j5sxwibkwh0p94iwi4cx8rphgi-zxing-cpp-1.4.0"
error:
… while calling the 'import' builtin
at «string»:1:1:
1| import "/nix/store/nvis47j5sxwibkwh0p94iwi4cx8rphgi-zxing-cpp-1.4.0"
| ^
error: path '/nix/store/nvis47j5sxwibkwh0p94iwi4cx8rphgi-zxing-cpp-1.4.0' does not exist
# Okay try to import the path passed in as path instead of string
nix-repl> import /nix/store/nvis47j5sxwibkwh0p94iwi4cx8rphgi-zxing-cpp-1.4.0
error:
… while calling the 'import' builtin
at «string»:1:1:
1| import /nix/store/nvis47j5sxwibkwh0p94iwi4cx8rphgi-zxing-cpp-1.4.0
| ^
error: path '/nix/store/nvis47j5sxwibkwh0p94iwi4cx8rphgi-zxing-cpp-1.4.0' does not exist
itsfarseen
changed the title
Docs that explain Import From Derivation is wrong
Docs that explain Import From Derivation is missing some context
Mar 18, 2025
Problem
Here: https://nix.dev/manual/nix/2.24/language/import-from-derivation
It is mentioned that:
It also says:
Counter example:
But:
How does this work?
Proposal
Checklist
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: