-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
builtins.path
with builtins.filterSource
copies all files to /nix/store
#5870
Comments
A solution for this problem exists in Nixpkgs. The For example: src = cleanSourceWith {
filter = path: type: f path type;
src = nix-gitignore.gitignoreSourcePure [ "target" ] ./.;
}; Here the nix-gitignore source's |
It doesn't actually work. The entire I've tried this:
And this:
And this (
|
Oh, you must be using flakes then, where |
I've tried building my package using nix 2.3.16 - it has the same issue. It also spits a warning: |
I've figured out what's wrong with my setup. I've had the following function to simplify package management in my monorepo:
I can use this function to get an attrset with all my packages without manually defining all of them: The actual issue was with I've modified the first function to use
|
Describe the bug
My issue is with the way
builtins.path
works withbuiltins.filterSource
.After compiling rust package using
cargo
, it dumps gigabytes of its files totarget
directory. When I later runnix-build
, the entire package directory with gigabytes of garbage gets copied to/nix/store
and only thenbuiltins.path
takes only what is needed.After running
cargo build
andnix-build
several times,/nix/store
hogs all available disk space.Steps To Reproduce
I'm using
nix-gitignore.gitignoreSourcePure
in my rust package:src = nix-gitignore.gitignoreSourcePure [ "target" ] ./.;
Expected behavior
Maybe it's possible to filter sources without copying everything to
/nix/store
?nix-env --version
outputnix-env (Nix) 2.5.1
The text was updated successfully, but these errors were encountered: