on iko/ghcjs-patch-master help sign in
Eval pkg-set with a correct `buildModules` arg (#1258)

issued from from top-level modules evaluation. Otherwise `buildModules` can be wrong, failing to correctly evaluate modules that can change pkg-set, like: ``` {pkgs, ... }: { cabalProjectLocal = optionalString pkgs.stdenv.hostPlatform.isWindows '' constraints: Win32 ==2.6.1.0, mintty ==0.1.2 ''; } ```

commit280ec975e10983f19f02836d68911001489dd14c authorJean-Baptiste Giraudeau <jean-baptiste.giraudeau@iohk.io> dateTue 5 Oct 2021, 12:53 (5 years ago) parent422c661
1 file changed+11−5
overlays/haskell.nix+11−5
overlays/haskell.nix+11−5
@@ -499,10 +499,13 @@ final: prev: {
499499 else mkCabalProjectPkgSet
500500 { inherit compiler-nix-name plan-pkgs;
501501 pkg-def-extras = args.pkg-def-extras or [];
502− modules = (args.modules or [])
503− ++ final.lib.optional (args.ghcOverride != null || args.ghc != null)
504− { ghc.package = if args.ghcOverride != null then args.ghcOverride else args.ghc; }
505− ++ [ { compiler.nix-name = final.lib.mkForce args.compiler-nix-name; } ];
502+ modules = [ { _module.args.buildModules = final.lib.mkForce (if final.stdenv.hostPlatform != final.stdenv.buildPlatform
503+ then (final.buildPackages.haskell-nix.cabalProject' projectModule).pkg-set
504+ else pkg-set); } ]
505+ ++ (args.modules or [])
506+ ++ final.lib.optional (args.ghcOverride != null || args.ghc != null)
507+ { ghc.package = if args.ghcOverride != null then args.ghcOverride else args.ghc; }
508+ ++ [ { compiler.nix-name = final.lib.mkForce args.compiler-nix-name; } ];
506509 extra-hackages = args.extra-hackages or [];
507510 };
508511
@@ -771,7 +774,10 @@ final: prev: {
771774 in let pkg-set = mkStackPkgSet
772775 { stack-pkgs = importAndFilterProject callProjectResults;
773776 pkg-def-extras = (args.pkg-def-extras or []);
774− modules = final.lib.singleton (mkCacheModule cache)
777+ modules = [ { _module.args.buildModules = final.lib.mkForce (if final.stdenv.hostPlatform != final.stdenv.buildPlatform
778+ then (final.buildPackages.haskell-nix.stackProject' projectModule).pkg-set
779+ else pkg-set); }
780+ (mkCacheModule cache) ]
775781 ++ (args.modules or [])
776782 ++ final.lib.optional (args.ghc != null) { ghc.package = args.ghc; }
777783 ++ final.lib.optional (args.compiler-nix-name != null)