-
-
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
Haskell mkDerivation env attribute sucks in the source #51079
Comments
@infinisil @ElvishJerricco @peti ccing you guys as you all show up in the log around the new |
The |
Let me restate the issue. Should |
|
While I work to follow what your response above, I offer you this counter challenge cat example.nix with import <nixpkgs> { };
let
example = { mkDerivation, stdenv, base, linear }: mkDerivation {
pname = "example";
version = "0.0.1";
src = throw "what does the current source have to do with env?";
libraryHaskellDepends = [ base linear ];
license = stdenv.lib.licenses.bsd3;
};
in
(haskellPackages.callPackage example { }).env On my 18.03 based desktop [tyson@tux:~]$ nix-shell example.nix
[nix-shell:~]$ on my 18.09 laptop [tyson@manny:~]$ nix-shell example.nix
error: what does the current source have to do with env?
(use '--show-trace' to show detailed location information) [tyson@manny:~]$ nix-shell --show-trace example.nix
error: while evaluating the attribute 'NIX_GHC' of the derivation 'ghc-shell-for-example-0.0.1' at /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/pkgs/stdenv/generic/make-derivation.nix:177:11:
while evaluating 'ghcWithPackages' at /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/pkgs/development/haskell-modules/make-package-set.nix:219:23, called from /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/pkgs/development/haskell-modules/make-package-set.nix:275:18:
while evaluating 'withPackages' at /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/pkgs/development/haskell-modules/make-package-set.nix:116:18, called from /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/pkgs/development/haskell-modules/make-package-set.nix:219:35:
while evaluating 'callPackageWith' at /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/lib/customisation.nix:108:35, called from /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/pkgs/development/haskell-modules/make-package-set.nix:116:28:
while evaluating 'makeOverridable' at /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/lib/customisation.nix:67:24, called from /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/lib/customisation.nix:112:8:
while evaluating anonymous function at /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/pkgs/development/haskell-modules/with-packages-wrapper.nix:1:1, called from /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/lib/customisation.nix:69:12:
while evaluating 'closePropagation' at /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/lib/deprecated.nix:228:22, called from /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/pkgs/development/haskell-modules/with-packages-wrapper.nix:45:57:
while evaluating 'uniqList' at /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/lib/deprecated.nix:159:14, called from /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/lib/deprecated.nix:228:29:
while evaluating 'go' at /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/lib/deprecated.nix:160:18, called from /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/lib/deprecated.nix:166:8:
while evaluating 'innerClosePropagation' at /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/lib/deprecated.nix:211:32, called from /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/lib/deprecated.nix:228:52:
while evaluating anonymous function at /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/pkgs/development/haskell-modules/make-package-set.nix:275:32, called from /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/pkgs/development/haskell-modules/make-package-set.nix:219:49:
while evaluating anonymous function at /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/pkgs/development/haskell-modules/make-package-set.nix:270:12, called from undefined position:
while evaluating anonymous function at /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/pkgs/development/haskell-modules/make-package-set.nix:270:33, called from /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/pkgs/development/haskell-modules/make-package-set.nix:270:19:
while evaluating the attribute 'outPath' at /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/lib/customisation.nix:150:7:
while evaluating the attribute 'src' of the derivation 'example-0.0.1' at /nix/store/l9hcs7gapmg0d0hizi146h9mn03774ga-nixos-18.09/nixos/pkgs/stdenv/generic/make-derivation.nix:177:11:
what does the current source have to do with env? |
Okay. I followed your example through. The I don't disagree with this. What I am saying is when you used to use the Strangely, in my testing, whether it explodes or not seems to depend on exactly what libraries you include. If you include just Thanks! -Tyson |
After bisecting it was clear that my #46453 was the cause of this, now trying to figure out why.. |
Aha! I found the culprit. It's these lines originally introduced by @ElvishJerricco in #36393 (comment): nixpkgs/pkgs/development/haskell-modules/make-package-set.nix Lines 272 to 277 in 483914b
It's to filter out dependencies that are in the selected package list, because those usually want to get build by cabal directly (for development), not through nix. The Now how could we solve this:
|
This also explains why it didn't blow up with |
@infinisil I think filtering on the name field is a fine alternative. A little disappointing that we don't get the nice exactness, but it'll be fine. Alternatively, we could do the |
@twhitehead, you were right! Nice catch. Thank you for following through with the bug report. |
@peti no problem. Reading back through my original error report, I can see it wasn't the greatest for really bringing out the issue. I really should have led with the second |
So I've tested this both ways: comparing |
@ElvishJerricco I think the |
shellFor: Don't suck in src to compare to deps. [Fixes #51079]
Thanks! 👍 |
This reverts commit b40b39b. tarball job failed: error: while evaluating anonymous function at /build/source/maintainers/scripts/find-tarballs.nix:6:1, called from undefined position: while evaluating 'operator' at /build/source/maintainers/scripts/find-tarballs.nix:27:16, called from undefined position: while evaluating 'immediateDependenciesOf' at /build/source/maintainers/scripts/find-tarballs.nix:39:29, called from /build/source/maintainers/scripts/find-tarballs.nix:27:44: while evaluating anonymous function at /build/source/lib/attrsets.nix:225:10, called from undefined position: while evaluating anonymous function at /build/source/maintainers/scripts/find-tarballs.nix:40:37, called from /build/source/lib/attrsets.nix:225:16: while evaluating 'derivationsIn' at /build/source/maintainers/scripts/find-tarballs.nix:42:19, called from /build/source/maintainers/scripts/find-tarballs.nix:40:40: while evaluating 'optional' at /build/source/lib/lists.nix:241:20, called from /build/source/maintainers/scripts/find-tarballs.nix:44:33: while evaluating 'canEval' at /build/source/maintainers/scripts/find-tarballs.nix:48:13, called from /build/source/maintainers/scripts/find-tarballs.nix:44:43: while evaluating the attribute 'drvPath' at /build/source/lib/customisation.nix:149:7: while evaluating the derivation attribute 'name' at /build/source/pkgs/stdenv/generic/make-derivation.nix:177:11: while evaluating 'nullSrc' at /build/source/pkgs/development/haskell-modules/make-package-set.nix:263:19, called from undefined position: while evaluating 'overrideCabal' at /build/source/pkgs/development/haskell-modules/lib.nix:37:24, called from /build/source/pkgs/development/haskell-modules/make-package-set.nix:263:22: attribute 'override' missing, at /build/source/pkgs/development/haskell-modules/lib.nix:37:28
Reopening because the related commit was reverted in 18.09 in a1156b9, because the tarball job was failing. |
Funny that revert commits also close issues :) |
I am unsure about the state of this issue. Is this still relevant? |
@peti Not totally sure, but it seems fixed: (with import (fetchTarball channel:nixos-19.09) {}; haskellPackages.mkDerivation {
pname = "foo";
version = "1";
license = null;
src = ./foobarbazbar;
}).env $ mkdir ./foobarbazbar
$ nix-shell foo.nix --run :
$ find /nix/store -maxdepth 1 -name "*-foobarbazbar" The |
@ElvishJerricco See #51079 (comment), I can still reproduce it with that example there |
I haven't done any further looking into this since the reversion, but, at least in the original issue, you need a dependency outside of base to trigger it, such as |
Thank you for your contributions.
|
Just finished checking my earlier test case (#51079 (comment)) and pleased to report there is no exception thrown on 20.03. I'll close this issue. Thanks everyone for the work! 😄 |
This has reoccurred, in fact I opened a duplicate issue I think some months ago: #86775 I also have a minimal reproducer https://github.com/expipiplus1/nix-repro-86775 |
Issue description
I'm using a setup based on the nixpkgs manual haskell guide. Since switching to the 18.09 package set,
nix-shell
now dumps my development directory to the store every time it is run.This adds significant shell start up time and consumes a lot of unnecessary disk space by constant snapshotting my work.
I believe the issue is that the
env
attribute of the haskellmkDerivation
function now sucks in the source specified inmkDerivation
, which is set to./.
bycabal2nix .
when following the haskell development instructions in the nixpkgs manual.Steps to reproduce
Here is a small example of following the directions (where we are using
lub
to simulate our own package that we are developing)Technical details
Here is the requested info. Note that the machine I'm currently on is 18.03, but I'm running against the 18.09 channel for the development that I'm currently doing.
"x86_64-linux"
Linux 4.16.17, NixOS, 18.03.132768.94d80eb7247 (Impala)
yes
yes
nix-env (Nix) 2.0.4
"nixpkgs-18.09.1206.6d6e4e6b558"
/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs
The text was updated successfully, but these errors were encountered: