-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This has the intention to address various issues with the existing `builtins.filterSource` and surrounding library functions: * The library functions existing so far are not straightforward to use correctly and are hard to remember. Consequently only few people use them. * Most existing functions are about *excluding* unwanted files, making various hardcodes (such as `.o` and `.so` in `cleanSourceFilter`) that typically still forget some other unwanted files. The added approach is more about explicitly listing wanted files, thus being more reliable. * This very frequently results in non-reproducible builds when working from project working trees (as opposed to nixpkgs `pkgs` builds, which always operate from clean checkouts), with "build", "gen" or similar directories being accidentally included as sources. It is also a common sources of the dreaded warning: dumping very large path (> 256 MiB); this may run out of memory message (and as indicated, bad for performance). * The most common antipattern regarding the above is `src = ./.`. To prevent it, we need to provide functionality that's straightforward to understand and convenient. * `builtins.filterSource f ./.` can result in build impurities depending on the basename of the parent directory (see NixOS/nix#1305). A solution to that is `builtins.path`, or its use in `cleanSourceWith` (see #67996). The added function makes its use very convenient. * The existing functions make it difficult to debug what files are included and why. The added function provides an argument `debugTraceEnable`, that makes debugging easy. After spending tens of hours of tracking down irreproducible builds resulting from bad `src =` assignments in various projects, I hope that this function will put an end to it.
- Loading branch information
Showing
2 changed files
with
212 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters