@@ -496,6 +496,7 @@ final: prev: {
496 # separately from the hsPkgs. The advantage is that the you can get the
496 # separately from the hsPkgs. The advantage is that the you can get the
497 # plan-nix without building the project.
497 # plan-nix without building the project.
498 cabalProject' =
498 cabalProject' =
499+ projectModule: haskellLib.evalProjectModule ../modules/cabal-project.nix projectModule (
499 { src, compiler-nix-name, ... }@args':
500 { src, compiler-nix-name, ... }@args':
501 args = { caller = "cabalProject'"; } // args';
502 args = { caller = "cabalProject'"; } // args';
@@ -515,10 +516,9 @@ final: prev: {
515 { inherit compiler-nix-name plan-pkgs;
516 { inherit compiler-nix-name plan-pkgs;
516 pkg-def-extras = args.pkg-def-extras or [];
517 pkg-def-extras = args.pkg-def-extras or [];
517 modules = (args.modules or [])
518 modules = (args.modules or [])
518− ++ final.lib.optional (args ? ghcOverride || args ? ghc)
519+ ++ final.lib.optional (args.ghcOverride != null || args.ghc != null)
519− { ghc.package = args.ghcOverride or args.ghc; }
520+ { ghc.package = if args.ghcOverride != null then args.ghcOverride else args.ghc; }
520− ++ final.lib.optional (args ? compiler-nix-name)
521− { compiler.nix-name = final.lib.mkForce args.compiler-nix-name; };
521+ ++ [ { compiler.nix-name = final.lib.mkForce args.compiler-nix-name; } ];
522 extra-hackages = args.extra-hackages or [];
522 extra-hackages = args.extra-hackages or [];
@@ -531,9 +531,9 @@ final: prev: {
531 tools = final.buildPackages.haskell-nix.tools pkg-set.config.compiler.nix-name;
531 tools = final.buildPackages.haskell-nix.tools pkg-set.config.compiler.nix-name;
532 roots = final.haskell-nix.roots pkg-set.config.compiler.nix-name;
532 roots = final.haskell-nix.roots pkg-set.config.compiler.nix-name;
533 projectFunction = haskell-nix: haskell-nix.cabalProject';
533 projectFunction = haskell-nix: haskell-nix.cabalProject';
534− projectArgs = args';
534+ inherit projectModule;
536− in project;
536+ in project);
539 # Take `hsPkgs` from the `rawProject` and update all the packages and
539 # Take `hsPkgs` from the `rawProject` and update all the packages and
@@ -583,7 +583,7 @@ final: prev: {
583 projectCoverageReport = haskellLib.projectCoverageReport project (map (pkg: pkg.coverageReport) (final.lib.attrValues (haskellLib.selectProjectPackages hsPkgs)));
583 projectCoverageReport = haskellLib.projectCoverageReport project (map (pkg: pkg.coverageReport) (final.lib.attrValues (haskellLib.selectProjectPackages hsPkgs)));
585 projectCross = (final.lib.mapAttrs (_: pkgs:
585 projectCross = (final.lib.mapAttrs (_: pkgs:
586− rawProject.projectFunction pkgs.haskell-nix rawProject.projectArgs
586+ rawProject.projectFunction pkgs.haskell-nix rawProject.projectModule
587 ) final.pkgsCross) // { recurseForDerivations = false; };
587 ) final.pkgsCross) // { recurseForDerivations = false; };
589 # Like `.hsPkgs.${packageName}` but when compined with `getComponent` any
589 # Like `.hsPkgs.${packageName}` but when compined with `getComponent` any
@@ -684,25 +684,23 @@ final: prev: {
684 inherit (rawProject.hsPkgs) makeConfigFiles ghcWithHoogle ghcWithPackages shellFor;
684 inherit (rawProject.hsPkgs) makeConfigFiles ghcWithHoogle ghcWithPackages shellFor;
688− { src, compiler-nix-name, ... }@args':
690− args = { caller = "hackage-package"; } // args';
691− p = cabalProject' args;
687+ cabalProject = args: let p = cabalProject' args;
692 in p.hsPkgs // p;
688 in p.hsPkgs // p;
694 stackProject' =
690 stackProject' =
691+ projectModule: haskellLib.evalProjectModule ../modules/stack-project.nix projectModule (
695 { src, ... }@args:
692 { src, ... }@args:
696− let callProjectResults = callStackToNix ({ inherit cache; } // args);
693+ let callProjectResults = callStackToNix (args
694+ // final.lib.optionalAttrs (args.cache == null) { inherit cache; });
697 generatedCache = genStackCache args;
695 generatedCache = genStackCache args;
698− cache = args.cache or generatedCache;
696+ cache = if args.cache != null then args.cache else generatedCache;
699 in let pkg-set = mkStackPkgSet
697 in let pkg-set = mkStackPkgSet
700 { stack-pkgs = importAndFilterProject callProjectResults;
698 { stack-pkgs = importAndFilterProject callProjectResults;
701 pkg-def-extras = (args.pkg-def-extras or []);
699 pkg-def-extras = (args.pkg-def-extras or []);
702 modules = final.lib.singleton (mkCacheModule cache)
700 modules = final.lib.singleton (mkCacheModule cache)
703 ++ (args.modules or [])
701 ++ (args.modules or [])
704− ++ final.lib.optional (args ? ghc) { ghc.package = args.ghc; }
702+ ++ final.lib.optional (args.ghc != null) { ghc.package = args.ghc; }
705− ++ final.lib.optional (args ? compiler-nix-name)
703+ ++ final.lib.optional (args.compiler-nix-name != null)
706 { compiler.nix-name = final.lib.mkForce args.compiler-nix-name; };
704 { compiler.nix-name = final.lib.mkForce args.compiler-nix-name; };
@@ -714,9 +712,9 @@ final: prev: {
714 tools = final.buildPackages.haskell-nix.tools pkg-set.config.compiler.nix-name;
712 tools = final.buildPackages.haskell-nix.tools pkg-set.config.compiler.nix-name;
715 roots = final.haskell-nix.roots pkg-set.config.compiler.nix-name;
713 roots = final.haskell-nix.roots pkg-set.config.compiler.nix-name;
716 projectFunction = haskell-nix: haskell-nix.stackProject';
714 projectFunction = haskell-nix: haskell-nix.stackProject';
717− projectArgs = args;
715+ inherit projectModule;
719− in project;
717+ in project);
721 stackProject = args: let p = stackProject' args;
719 stackProject = args: let p = stackProject' args;
722 in p.hsPkgs // p;
720 in p.hsPkgs // p;
@@ -732,7 +730,7 @@ final: prev: {
732 # used (as it will use a default `cabal.project`).
730 # used (as it will use a default `cabal.project`).
733 project' = { src, projectFileName ? null, ... }@args':
731 project' = { src, projectFileName ? null, ... }@args':
735− args = { caller = "project'"; } // args';
733+ args = { caller = "project'"; } // final.lib.filterAttrs (n: _: n != "projectFileName") args';
736 dir = __readDir (src.origSrcSubDir or src);
734 dir = __readDir (src.origSrcSubDir or src);
737 exists = fileName: builtins.elem (dir.${fileName} or "") ["regular" "symlink"];
735 exists = fileName: builtins.elem (dir.${fileName} or "") ["regular" "symlink"];
738 stackYamlExists = exists "stack.yaml";
736 stackYamlExists = exists "stack.yaml";