stack-to-nix: extra-deps repeated in .stack-pkgs.nix
If the same dependency is listed extra-deps of stack.yaml and it also appears in the packages of the resolver, then it will be output twice in .stack-pkgs.nix.
The error will look like:
error: attribute 'Chart' at /home/rodney/iohk/cardano-wallet/nix/.stack-pkgs.nix:8:9 already defined at /home/rodney/iohk/cardano-wallet/nix/.stack-pkgs.nix:6:9
Uhh Oh, that's not good.
I think we're going to need to decide on a canonical set of override priorities. Something like package-set = 1000;, extra-deps = 900;, local-packages = 800; so that we can specify what degree of overriding we're trying to do. Then we can segment the options into submodules of the same type that get merged with priorities auto-applied.
i.e. instead of having package-sets, extra-deps, local packages, and overrides all in the same packages option, split them up into submodules, and automatically form packages from them with priorities applied.
{
package-set.lens.flags.foo = true;
extra-deps.lens = import ./lens.nix;
local-packages.mypkg = import ./.;
local-packages.lens.flags.bar = false;
}
By setting extra-deps.lens, we override package-set.lens completely, rendering our foo = true; ignored. Then, local-packages.lens.flags.bar = false; sets the flag on any lens with priority local-packages or weaker, implying we're setting it on the extra-deps lens.
The benefit of having them merged into a total packages module is that users can make definitive overrides on that option if they need to for some unforeseen reason.