on iko/ghcjs-patch-master help sign in
Add project.buildProject (#1265)

* Add project.buildProject This exposes the project used by `buildModules`. * Update overlays/haskell.nix Co-authored-by: Jean-Baptiste Giraudeau <jean-baptiste.giraudeau@iohk.io> * Update overlays/haskell.nix Co-authored-by: Jean-Baptiste Giraudeau <jean-baptiste.giraudeau@iohk.io> * Fix syntax error Co-authored-by: Jean-Baptiste Giraudeau <jean-baptiste.giraudeau@iohk.io>

commit2b5ad5aced80e5675ceae9683d7a14810cb54777 authorHamish Mackenzie <Hamish.Mackenzie@iohk.io> dateMon 11 Oct 2021, 23:38 (5 years ago) parent9abb33b
1 file changed+12−9
overlays/haskell.nix+12−9
overlays/haskell.nix+12−9
@@ -488,6 +488,9 @@ final: prev: {
488488 plan-pkgs = importAndFilterProject {
489489 inherit (callProjectResults) projectNix sourceRepos src;
490490 };
491+ buildProject = if final.stdenv.hostPlatform != final.stdenv.buildPlatform
492+ then final.buildPackages.haskell-nix.cabalProject' projectModule
493+ else project;
491494 pkg-set = if plan-pkgs ? configurationError
492495 then {
493496 inherit (plan-pkgs) configurationError;
@@ -499,9 +502,7 @@ final: prev: {
499502 else mkCabalProjectPkgSet
500503 { inherit compiler-nix-name plan-pkgs;
501504 pkg-def-extras = args.pkg-def-extras or [];
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+ modules = [ { _module.args.buildModules = final.lib.mkForce buildProject.pkg-set; } ]
505506 ++ (args.modules or [])
506507 ++ final.lib.optional (args.ghcOverride != null || args.ghc != null)
507508 { ghc.package = if args.ghcOverride != null then args.ghcOverride else args.ghc; }
@@ -518,7 +519,7 @@ final: prev: {
518519 tools = final.buildPackages.haskell-nix.tools pkg-set.config.compiler.nix-name;
519520 roots = final.haskell-nix.roots pkg-set.config.compiler.nix-name;
520521 projectFunction = haskell-nix: haskell-nix.cabalProject';
521− inherit projectModule args;
522+ inherit projectModule buildProject args;
522523 };
523524 in project);
524525
@@ -771,12 +772,14 @@ final: prev: {
771772 // final.lib.optionalAttrs (args.cache == null) { inherit cache; });
772773 generatedCache = genStackCache args;
773774 cache = if args.cache != null then args.cache else generatedCache;
774− in let pkg-set = mkStackPkgSet
775+ in let
776+ buildProject = if final.stdenv.hostPlatform != final.stdenv.buildPlatform
777+ then final.buildPackages.haskell-nix.stackProject' projectModule
778+ else project;
779+ pkg-set = mkStackPkgSet
775780 { stack-pkgs = importAndFilterProject callProjectResults;
776781 pkg-def-extras = (args.pkg-def-extras or []);
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); }
782+ modules = [ { _module.args.buildModules = final.lib.mkForce buildProject.pkg-set; }
780783 (mkCacheModule cache) ]
781784 ++ (args.modules or [])
782785 ++ final.lib.optional (args.ghc != null) { ghc.package = args.ghc; }
@@ -792,7 +795,7 @@ final: prev: {
792795 tools = final.buildPackages.haskell-nix.tools pkg-set.config.compiler.nix-name;
793796 roots = final.haskell-nix.roots pkg-set.config.compiler.nix-name;
794797 projectFunction = haskell-nix: haskell-nix.stackProject';
795− inherit projectModule args;
798+ inherit projectModule buildProject args;
796799 };
797800 in project);
798801