This works by extracting out some logic from generic-builder.nix to make it possible to get at the relevant information by overriding mkDerivation for the haskell package.