@@ -488,6 +488,9 @@ final: prev: {
488 plan-pkgs = importAndFilterProject {
488 plan-pkgs = importAndFilterProject {
489 inherit (callProjectResults) projectNix sourceRepos src;
489 inherit (callProjectResults) projectNix sourceRepos src;
491+ buildProject = if final.stdenv.hostPlatform != final.stdenv.buildPlatform
492+ then final.buildPackages.haskell-nix.cabalProject' projectModule
491 pkg-set = if plan-pkgs ? configurationError
494 pkg-set = if plan-pkgs ? configurationError
493 inherit (plan-pkgs) configurationError;
496 inherit (plan-pkgs) configurationError;
@@ -499,9 +502,7 @@ final: prev: {
499 else mkCabalProjectPkgSet
502 else mkCabalProjectPkgSet
500 { inherit compiler-nix-name plan-pkgs;
503 { inherit compiler-nix-name plan-pkgs;
501 pkg-def-extras = args.pkg-def-extras or [];
504 pkg-def-extras = args.pkg-def-extras or [];
502− modules = [ { _module.args.buildModules = final.lib.mkForce (if final.stdenv.hostPlatform != final.stdenv.buildPlatform
505+ modules = [ { _module.args.buildModules = final.lib.mkForce buildProject.pkg-set; } ]
503− then (final.buildPackages.haskell-nix.cabalProject' projectModule).pkg-set
505 ++ (args.modules or [])
506 ++ (args.modules or [])
506 ++ final.lib.optional (args.ghcOverride != null || args.ghc != null)
507 ++ final.lib.optional (args.ghcOverride != null || args.ghc != null)
507 { ghc.package = if args.ghcOverride != null then args.ghcOverride else args.ghc; }
508 { ghc.package = if args.ghcOverride != null then args.ghcOverride else args.ghc; }
@@ -518,7 +519,7 @@ final: prev: {
518 tools = final.buildPackages.haskell-nix.tools pkg-set.config.compiler.nix-name;
519 tools = final.buildPackages.haskell-nix.tools pkg-set.config.compiler.nix-name;
519 roots = final.haskell-nix.roots pkg-set.config.compiler.nix-name;
520 roots = final.haskell-nix.roots pkg-set.config.compiler.nix-name;
520 projectFunction = haskell-nix: haskell-nix.cabalProject';
521 projectFunction = haskell-nix: haskell-nix.cabalProject';
521− inherit projectModule args;
522+ inherit projectModule buildProject args;
523 in project);
524 in project);
@@ -771,12 +772,14 @@ final: prev: {
771 // final.lib.optionalAttrs (args.cache == null) { inherit cache; });
772 // final.lib.optionalAttrs (args.cache == null) { inherit cache; });
772 generatedCache = genStackCache args;
773 generatedCache = genStackCache args;
773 cache = if args.cache != null then args.cache else generatedCache;
774 cache = if args.cache != null then args.cache else generatedCache;
776+ buildProject = if final.stdenv.hostPlatform != final.stdenv.buildPlatform
777+ then final.buildPackages.haskell-nix.stackProject' projectModule
774− in let pkg-set = mkStackPkgSet
779+ pkg-set = mkStackPkgSet
775 { stack-pkgs = importAndFilterProject callProjectResults;
780 { stack-pkgs = importAndFilterProject callProjectResults;
776 pkg-def-extras = (args.pkg-def-extras or []);
781 pkg-def-extras = (args.pkg-def-extras or []);
777− modules = [ { _module.args.buildModules = final.lib.mkForce (if final.stdenv.hostPlatform != final.stdenv.buildPlatform
782+ modules = [ { _module.args.buildModules = final.lib.mkForce buildProject.pkg-set; }
778− then (final.buildPackages.haskell-nix.stackProject' projectModule).pkg-set
780 (mkCacheModule cache) ]
783 (mkCacheModule cache) ]
781 ++ (args.modules or [])
784 ++ (args.modules or [])
782 ++ final.lib.optional (args.ghc != null) { ghc.package = args.ghc; }
785 ++ final.lib.optional (args.ghc != null) { ghc.package = args.ghc; }
@@ -792,7 +795,7 @@ final: prev: {
792 tools = final.buildPackages.haskell-nix.tools pkg-set.config.compiler.nix-name;
795 tools = final.buildPackages.haskell-nix.tools pkg-set.config.compiler.nix-name;
793 roots = final.haskell-nix.roots pkg-set.config.compiler.nix-name;
796 roots = final.haskell-nix.roots pkg-set.config.compiler.nix-name;
794 projectFunction = haskell-nix: haskell-nix.stackProject';
797 projectFunction = haskell-nix: haskell-nix.stackProject';
795− inherit projectModule args;
798+ inherit projectModule buildProject args;
797 in project);
800 in project);