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
Cleaning is broken for stack projects #1013
Comments
We have changed stuff recently in the way cabal components are clean, so this might be a bug. Are you using explicit I would also recommend clean the project |
Using Why is it neeed to have full copy of source tree in nix store upon entering nix shell? |
The source for each package should be filtered further to just be the source of that package. But it is a bit odd that you have the any source being copied in for each |
Is it surprising that the source is in the store? It's not surprising to me - it has to run cabal configure, and ot can only do that on things in the store, no? (This only applies to non-materialised projects) |
For the configure step we filter it down to only contain |
Although the way that source filtering step got done was changed recently. @hamishmack do you think we could conceivably be copying the pre-filtering source as well? |
I'm pretty certain this is a regression that came in here: This change means that every package now has
and I'm inclined to agree. |
What gets created on every
Looks like it all boils down to |
Nix shouldn't (can't) produce a different hash time, so you must have something changing. If you can find the path (I used @quetz I suggest reverting the line I linked to in #843, though. Just to reiterate, that's changing
|
Yeah, but source code is changing (I insert empty line, so this is noop change). It should lead to different hash and if everything else refers to this new source it gets new hash too...
Will experiment with that, thanks. |
It is much better with this change. Some store paths are still created on each But still, is it possible to get shell in haskell.nix behave as advertised in nix?
I want to be dropped into shell where all dependencies of my project are built and registered, but project itself is not touched (do not configure my packages, do not make derivations that can be used to build these packages). |
How can I reproduce this issue? |
@hamishmack With the following directory structure:
That is, a directory structure where your |
I can't seem reproduce it that way. See https://github.com/hamishmack/test-1013.
Seems to work as expected for me. No derivations are rebuilt. It works with or without the One thing that would not work is if something was triggering the source to be copied to the store before the haskell.nix project function sees it. For instance if the example project was in
Nix will be forced to copy the all of
|
@hamishmack I'm not able to check that out right, now but I'd suggest instantiating the derivation for This isn't about things being rebuild, it's about a huge amount of stuff being copied into the store. It's naturally not noticable with a small test case, which is why I suggest making In all of my tests with |
Ok, I had a chance to look at indeed |
I think I have also encountered this error just now. We are using
This socket file is being filtered out using the nixpkgs Broken:
Works:
|
I did not realise you were using |
Try this PR - hamishmack/test-1013#1 |
Doh. Still seems to work correctly. |
I wonder if it might only affect stack projects? |
Switching to a stack based project does it! hamishmack/test-1013@f003490 We must be doing something wrong in handling of stack projects. |
I think the problem is that we never got around to adding code to clean the source to In
I think we can do something similar in |
How do you test it?
I do not ever invoke |
I am testing with:
|
It's definitely not Stack only as this effects us, but we don't use stack! I have a to-do to try and investigate more |
Ah think I understand now. Its not foo that is the problem. The question is why does this copy to the store:
|
That is odd. |
Hmm maybe not, probably just .drv for bar exe and its setup drv. |
That's not only .drv, but source code is copied into store upon entering nix-shell (see, my previous message with example of nix store paths that are actually added). |
@ocharles do you have a package in the root of your project? It looks like that was broken. The test case had both packages in subdirs. I came across filtering issues while updating Leksah to the latest haskell.nix. There were two bugs, one resulted in all the files being copied and the other one (that was masked by the first) caused filtering to when it ran to leave files out. #1041 fixes it for Leksah. |
Do you mean a |
A |
I'm pretty sure we don't have that but I'll double check tomorrow |
When a package is not in a subdirectory, but instead in the root of the project the cleaning of the package source was broken. This might explain why some `cabal.project` file based projects might also see be affected by #1013.
Has there been any attempt to fix this issue? We've just tried upgrading haskell.nix on our large, monorepo stack project in order to use a newer LTS and GHC 8.10.4, but copying our entire project source tree for every component means it takes > 30 minutes before anything even gets built. |
Update: nevermind. I just figured out that it is the
|
Please try out #1074 as it might help. The Are you using |
The issue I was having was after |
That indicates that the component filter is failing completely (the files should be filtered when the component builds to just the ones referenced in the Unfortunately just changing to Perhaps try the #1074 branch with this trace enabled. It should tell log for every file in the component the reason it was not filtered (if it prints nothing then the filter is not even running). |
I have checked #1074 issue I was able to reproduce before (a file I used
Only the files for the component are were included. |
@hamishmack I tried it and got the same result. I think the issue is that there are two source trees copied to the nix store, one is filtered down to just the component source, while the other contains all of our source. I build a single package and looked for the source afterwards, and found this
When I use my fork with |
I have merged #1074 into master as it at least stops |
Actually |
I think something must be accessing the package |
I haven't been able to track it down either. But having that |
I changed
So the entire source tree is being copied for each component because of the
Now I'm able to see that each of the nix store paths that have a full copy of our repo each have a Now I can see that all the nix store paths produced by
so they are not creating Unfortunately, this is still painfully slow and unusable. 😭 I don't have any insights as to why that might be. |
Using https://github.com/hercules-ci/gitignore.nix things work again using the latest master. Thanks! |
When a package is not in a subdirectory, but instead in the root of the project the cleaning of the package source was broken. This might explain why some `cabal.project` file based projects might also see be affected by input-output-hk#1013.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Using
project.shellFor
results in multiple (one for each package) copies of whole project directory (including dist-newstyle) in nix store. It happens duringclean-source-with-nix
evaluation that is part ofproject {..}
evaluation.Is there any way to avoid it? Growing nix store by several GB on each
nix-shell
invocation is pretty harsh.Looks like it is related to sources being needed for cabal setup (but I'm not sure here). In this case, is it possible to manually assemble pkgset and avoid this copying steps?
The text was updated successfully, but these errors were encountered: