@@ -105,6 +105,11 @@ self: super: {
105105 # The compiler referenced in the stack config
106106 compiler = (stack-pkgs.extras hackage).compiler or (pkg-def hackage).compiler;
107107 patchesModule = ghcHackagePatches.${compiler.nix-name} or {};
108+ # Remove fake packages generated from stack keywords used in ghc-options
109+ removeStackSpecial = module: if builtins.typeOf module == "set"
110+ then module // { packages = removeSpecialPackages (module.packages or {}); }
111+ else module;
112+ removeSpecialPackages = ps: removeAttrs ps [ "$locals" "$targets" "$everything" ];
108113 in mkPkgSet {
109114 pkg-def = excludeBootPackages pkg-def;
110115 pkg-def-extras = [ stack-pkgs.extras
@@ -115,7 +120,7 @@ self: super: {
115120 # and we should trust stackage here!
116121 modules = [ { doExactConfig = true; } patchesModule ]
117122 ++ modules
118− ++ stack-pkgs.modules or [];
123+ ++ map removeStackSpecial (stack-pkgs.modules or []);
119124 };
120125
121126 # Create a Haskell package set based on a Cabal configuration.