@@ -37,6 +37,24 @@ in
37 then { location, tag, ...}: sha256map."${location}"."${tag}"
37 then { location, tag, ...}: sha256map."${location}"."${tag}"
38 else _: null
38 else _: null
39, extra-hackage-tarballs ? []
39, extra-hackage-tarballs ? []
40+, source-repo-override ? {} # Cabal seems to behave incoherently when
41+ # two source-repository-package entries
42+ # provide the same packages, making it
43+ # impossible to override cabal.project
44+ # with e.g. a cabal.project.local. In CI,
45+ # we want to be able to test against the
46+ # latest versions of various dependencies.
48+ # This argument is a map from url to
49+ # a function taking the existing repoData
50+ # and returning the new repoData in its
53+ # { "https://github.com/input-output-hk/plutus-apps" = orig: orig // { subdirs = (orig.subdirs or [ "." ]) ++ [ "foo" ]; }; }
55+ # would result in the "foo" subdirectory of
56+ # any plutus-apps input being used for a
@@ -206,7 +224,8 @@ let
206 blocks = pkgs.lib.splitString "\nsource-repository-package\n" ("\n" + projectFile);
224 blocks = pkgs.lib.splitString "\nsource-repository-package\n" ("\n" + projectFile);
207 initialText = pkgs.lib.lists.take 1 blocks;
225 initialText = pkgs.lib.lists.take 1 blocks;
208 repoBlocks = builtins.map (pkgs.haskell-nix.haskellLib.parseBlock cabalProjectFileName lookupSha256) (pkgs.lib.lists.drop 1 blocks);
226 repoBlocks = builtins.map (pkgs.haskell-nix.haskellLib.parseBlock cabalProjectFileName lookupSha256) (pkgs.lib.lists.drop 1 blocks);
227+ overrideSourceRepo = sourceRepo: (source-repo-override.${sourceRepo.url} or (pkgs.lib.id)) sourceRepo;
209− sourceRepoData = pkgs.lib.lists.map (x: x.sourceRepo) repoBlocks;
228+ sourceRepoData = pkgs.lib.lists.map (x: overrideSourceRepo x.sourceRepo) repoBlocks;
210 otherText = pkgs.evalPackages.writeText "cabal.project" (pkgs.lib.strings.concatStringsSep "\n" (
229 otherText = pkgs.evalPackages.writeText "cabal.project" (pkgs.lib.strings.concatStringsSep "\n" (
211 initialText
230 initialText
212 ++ (builtins.map (x: x.otherText) repoBlocks)));
231 ++ (builtins.map (x: x.otherText) repoBlocks)));