Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add project.buildProject #1265

Merged
merged 4 commits into from
Oct 11, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions overlays/haskell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,9 @@ final: prev: {
plan-pkgs = importAndFilterProject {
inherit (callProjectResults) projectNix sourceRepos src;
};
buildProject = if final.stdenv.hostPlatform != final.stdenv.buildPlatform
then final.buildPackages.haskell-nix.cabalProject' projectModule
else project;
pkg-set = if plan-pkgs ? configurationError
then {
inherit (plan-pkgs) configurationError;
Expand All @@ -500,7 +503,7 @@ final: prev: {
{ inherit compiler-nix-name plan-pkgs;
pkg-def-extras = args.pkg-def-extras or [];
modules = [ { _module.args.buildModules = final.lib.mkForce (if final.stdenv.hostPlatform != final.stdenv.buildPlatform
hamishmack marked this conversation as resolved.
Show resolved Hide resolved
then (final.buildPackages.haskell-nix.cabalProject' projectModule).pkg-set
then buildProject.pkg-set
else pkg-set); } ]
++ (args.modules or [])
++ final.lib.optional (args.ghcOverride != null || args.ghc != null)
Expand All @@ -518,7 +521,7 @@ final: prev: {
tools = final.buildPackages.haskell-nix.tools pkg-set.config.compiler.nix-name;
roots = final.haskell-nix.roots pkg-set.config.compiler.nix-name;
projectFunction = haskell-nix: haskell-nix.cabalProject';
inherit projectModule args;
inherit projectModule buildProject args;
};
in project);

Expand Down Expand Up @@ -771,11 +774,15 @@ final: prev: {
// final.lib.optionalAttrs (args.cache == null) { inherit cache; });
generatedCache = genStackCache args;
cache = if args.cache != null then args.cache else generatedCache;
in let pkg-set = mkStackPkgSet
in let
buildProject = if final.stdenv.hostPlatform != final.stdenv.buildPlatform
then final.buildPackages.haskell-nix.stackProject' projectModule
else project;
pkg-set = mkStackPkgSet
{ stack-pkgs = importAndFilterProject callProjectResults;
pkg-def-extras = (args.pkg-def-extras or []);
modules = [ { _module.args.buildModules = final.lib.mkForce (if final.stdenv.hostPlatform != final.stdenv.buildPlatform
hamishmack marked this conversation as resolved.
Show resolved Hide resolved
then (final.buildPackages.haskell-nix.stackProject' projectModule).pkg-set
then buildProject.pkg-set
else pkg-set); }
(mkCacheModule cache) ]
++ (args.modules or [])
Expand All @@ -792,7 +799,7 @@ final: prev: {
tools = final.buildPackages.haskell-nix.tools pkg-set.config.compiler.nix-name;
roots = final.haskell-nix.roots pkg-set.config.compiler.nix-name;
projectFunction = haskell-nix: haskell-nix.stackProject';
inherit projectModule args;
inherit projectModule buildProject args;
};
in project);

Expand Down