[Nix-dev] Debugging a haskellPackages deep override gone wrong

Benno Fünfstück benno.fuenfstueck at gmail.com
Sun Feb 21 16:59:05 CET 2016


Hi Kosyrev,

The problem here is most likely that ghcOrig is already passed an overrides
argument, so you need to preserve the changes done by that:

ghc = ghcOrig.override (oldArgs: {

  overrides = with haskell.lib; new: old:

    let parent = (oldArgs.overrides or (_: _: {})) parent old;

    in parent // {

     # your overrides go here

    };

});


Unfortunately, I can't tell you a way you could have found this out
yourself other than either a) [this is how i've found it] already knowing
about this particular source of errors or b) messing around and reading
nixpkgs code till you eventually somehow get the idea that this is
happening (tbh, I can't tell you how I've managed to find the source of
this the first time it happenend to me. Perhaps I've had something more
obvious happen than just a missing dependency?). We simply don't have good
debugging tools for nix yet.


Regards,

Benno

Kosyrev Serge <_deepfire at feelingofgreen.ru> schrieb am So., 21. Feb. 2016
13:44:

> Good day folks!
>
> I'm facing a problem of a .drv generation gone wrong -- it's missing an
> input reference.  What I would like is some pointers to how go about
> debugging it.
>
> First an overview:
>
> What I have is a Nix expression which:
>
>   - depends on a set of haskell packages A, which in turn
>     - pull in among others a package B (actually, doctest)
>       - which I have to override (it's broken in GHC8).
>
> But when I perform the override, another package C
> (comonad, which depends on doctest) breaks, due to a missing input --
> which shouldn't be missing, at least according to its expression.
>
> Now, the details:
>
> I accomplish this deep override with the following incantation in
> default.nix:
>
> ,----
> | let
> |   pkgs     = (import <nixpkgs> {}).pkgs;
> |   haskell  = pkgs.haskell;
> |   ghcOrig  = haskell.packages.ghc801;
> |   ghc      = ghcOrig.override {
> |     overrides = with haskell.lib; new: old: {
> |       doctest = dontCheck (haskell.lib.overrideCabal old.doctest
> (oldAttrs: {
> |         src = pkgs.fetchgit {
> |                 url    = https://github.com/sol/doctest;
> |                 rev    = "d042176d41e8466de664198ef473bc2ae280e3e4";
> |                 sha256 =
> "15ffykfw4jmxqiziiz31yfcm8v4iq3iz9x882xvlvzi5b7b408yk";
> |         };
> |         };
> |       }));
> |     };
> |   };
> | in
> |  ghc.callPackage
> |  ({ mkDerivation, base, base-unicode-symbols, containers,
>  linear, netwire, pkgconfig, reflection, stdenv, vector }:
> | mkDerivation {
> |   ...
> | }) {}
> `----
>
> What happens when I call nix-build on this expression, is that suddenly
> a third, unrelated package starts missing a dependency:
>
> ,----
> | Configuring comonad-4.2.7.2...
> | Setup: Encountered missing dependencies:
> | transformers >=0.2 && <0.5
> `----
>
> ..whereas:
>   - its definition in hackage-packages does indeed list "transformers"
>   - the .drv of "comonad" being build is indeed missing a reference to
>     "transformers"
>
> So, obviously, the .drv evaluation has gone wrong.
>
> The question is -- how would one go about debugging it?
>
> --
> с уважениeм / respectfully,
> Косырев Сергей
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160221/82f47cc3/attachment-0001.html 


More information about the nix-dev mailing list