-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
shellFor with callCabal2nix puts all the package's src into the store instead of just package.yaml #86775
Comments
@expipiplus1 This is an eval-time add-to-store that's the problem, right? It seems hard to see how the derivation reference more stuff when the reference removed, right? |
@expipiplus1 Would you be able to come up with a minimal reproducible example of this? @Ericson2314 I'm having a little trouble understanding what you're asking.
From reading @expipiplus1's issue, it sounds to me like the problem is that the entire contents of the source directory is added to It doesn't sound to me that being eval-time vs. build-time is particularly the problem, just that the entire source directory was added to the store instead of just the
Are you referring to these lines in the diff posted above? - combinedPackages = pkgs.lib.filter
- (input: pkgs.lib.all (p: input.outPath or null != p.outPath) selected);
+ combinedPackages = x: x; This code is pretty complicated, and I'm not that familiar with it so I am hesitant to comment on it, but couldn't the old version be evaluating less stuff, depending on how The new version of The old version of While the new version ( |
Here's a repro case: https://github.com/expipiplus1/nix-repro-86775 |
The simplification suggested looks very suspicious to me. Like it is an improvement in this special use-case but breaks a lot of others. Maybe there are cases when we cannot be sure that no other files from the repo are needed to build the package? |
Ah, I certainly wasn't proposing that change as the correct solution! It was merely to demonstrate that the undesirable behaviour is caused (at least in part) by that function. |
Oh i see. If you change the last line of the |
Perhaps something simple like an additional argument to callCabal2nix to turn off this behavior would be a good stopgap |
But callCabal2nix requires the src, which means that the src has to get checked in to the nix-store, no? |
@jmininger it should only require package.yaml (or foo.cabal) |
@expipiplus1 First of all, does something like this work as a work around? let myPkgNoSrc = lib.attrsets.filterAttrs (n: _: n != "src") myPackage;
in shellFor { packages = p: [ myPkgNoSrc ]; } Second, when you refer to "it", do you mean the |
@jmininger I think so, however I like to use just one default.nix file for shells and building, so I'd have to toggle that behavior with The crux of this issue is that it's wrong for I think the correct solution would be to restate |
Hmm what if as a hack we get rid of the special case if the list only contains one element? The intent of the filtering is so one can make a sell for multiple packages where one is a dependency of the other, without building any of them, but this problem doesn't arise when there is only 1 package. |
@Ericson2314 That's a good idea. I wonder if it's possible to compare packages on the name rather than the outpath. |
I've updated my reproducer: https://github.com/expipiplus1/nix-repro-86775 |
I suspect that this could be fixed by making this line compare name (and version) instead of outpath: https://github.com/nixos/nixpkgs/blob/6586a9cdbe2db167bd36f3cc2df0edff1df43f25/pkgs/development/haskell-modules/make-package-set.nix#L366 It wouldn't be quite the same, but does it make any difference? |
I marked this as stale due to inactivity. → More info |
Still important
…On Fri, 4 Jun 2021, 11:05 pm stale[bot], ***@***.***> wrote:
I marked this as stale due to inactivity. → More info
<https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#86775 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGRJXDILMOEA7L4ZJ27FB3TRDTUDANCNFSM4MYX63QQ>
.
|
Describe the bug
haskellPackages.shellFor
's dependency on 'input.outPath' causes the wholesource to be put into the store, when just
package.yaml
would do forcallCabal2Nix
.To Reproduce
Steps to reproduce the behavior:
Enter a nix-shell for a package whose description is built using
callCabal2nix (https://github.com/expipiplus1/vulkan for example)
Observe that the whole directory is put into the store, if you're lucky
you'll get a message 'warning: dumping very large path (> 256 MiB); this may run out of memory'
Change nixpkgs thusly
Enter the shell again, observing that only 'package.yaml' is put into the store
Expected behavior
I would expect that entering a shell for a package wouldn't need to put all the source (sometimes including build artifacts and all of .git if there's no filter) into the store.
Notify maintainers
The text was updated successfully, but these errors were encountered: