When you pass something bogus into ghcWithPackages, it succeeds instead of failing loudly.
Write
nix-build --expr 'with import ./. {}; with import ./pkgs/development/haskell-modules/lib.nix { inherit pkgs lib; }; haskellPackages.ghcWithPackages (pkgs: with pkgs; [ dontCheck consul-haskell ])'
Debug an hour why it doesn't work (it builds the package with tests, ignoring dontCheck).
Realise that [ dontCheck consul-haskell ] should have been [ (dontCheck consul-haskell) ].
From @cleverca22
i would also expect ghcWithPackages to fail hard, because you gave it a lambda when it was expecting a string/package
so i'm surprised it even tried to build it
[clever@amd-nixos:~/apps/nixpkgs]$ nix-repl .
Welcome to Nix version 1.11.14. Type :? for help.
Loading '.'...
Added 7948 variables.
nix-repl> builtins.unsafeGetAttrPos "dontCheck" haskell.lib
{ column = 3; file = "/home/clever/apps/nixpkgs/pkgs/development/haskell-modules/lib.nix"; line = 24; }
nix-repl> builtins.unsafeGetAttrPos "ghcWithPackages" haskellPackages
{ column = 5; file = "/home/clever/apps/nixpkgs/pkgs/development/haskell-modules/make-package-set.nix"; line = 164; }
pkgs/development/haskell-modules/with-packages-wrapper.nix
paths = lib.filter (x: x ? isHaskellLibrary) (lib.closePropagation packages);
aha
nix-repl> haskellPackages.consul-haskell.isHaskellLibrary
true
if you give
ghcWithPackagesanything that lacks a.isHaskellLibraryattribute, it will silently filter it out of the package list
CC @cleverca22 @peti -- Ideally we could make it fail loudly on such errors.
Yeah, that's a good point. I suppose we could throw an error if any non-Haskell packages are included in the package list.
Filtering non-Haskell packages is a bit too agressive, one might have developer tools installed around.
I suggest we assert on non-derivations to catch errors like this.
Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly: