mirror of
https://github.com/NixOS/nix.git
synced 2025-11-23 10:49:36 +01:00
Make path values lazy
This fixes the double copy problem and improves performance
for expressions that don't force the whole source to be added to the
store.
Rules for fast expressions:
- Use path literals where possible
- import ./foo.nix
- Use + operator with slash in string
- src = fetchTree foo + "/src";
- Use source filtering, lib.fileset
- AVOID toString
- If possible, AVOID interpolations ("${./.}")
- If possible, move slashes into the interpolation to add less to the store
- "${./src}/foo" -> "${./src/foo}"
toString may be improved later as part of lazy-trees, so these
recommendations are a snapshot. Path values are quite nice though.
This commit is contained in:
parent
b79c918e09
commit
ee6a764988
7 changed files with 58 additions and 13 deletions
|
|
@ -105,4 +105,8 @@ CanonPath SourceAccessor::resolveSymlinks(
|
|||
return res;
|
||||
}
|
||||
|
||||
bool SourceAccessor::toStringReturnsStorePath() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue