Skip to content

Commit 220f8a9

Browse files
brainrakeL-as
authored andcommitted
separate repo for each of extraSources
1 parent 395dea9 commit 220f8a9

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

lib/call-cabal-project-to-nix.nix

+6-20
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ let
244244
repoResult = pkgs.haskell-nix.haskellLib.parseRepositories
245245
cabalProjectFileName sha256map inputMap cabal-install nix-tools sourceRepoPackageResult.otherText;
246246

247-
extraSourceRepo =
247+
extraSourceRepo = source:
248248
let
249249
src =
250250
pkgs.evalPackages.runCommand "extra-source-repository-package" {
@@ -253,31 +253,17 @@ let
253253
mkdir $out
254254
cd $out
255255
git init -b minimal
256-
${
257-
builtins.concatStringsSep "\n" (
258-
pkgs.lib.lists.zipListsWith
259-
(n: dep: "rsync -a --prune-empty-dirs ${dep.src}/ dep${builtins.toString n}/")
260-
(pkgs.lib.lists.range 0 ((builtins.length extraSources) - 1))
261-
extraSources
262-
)
263-
}
256+
rsync -a --prune-empty-dirs ${source.src}/ .
264257
git add --force .
265258
GIT_COMMITTER_NAME='No One' GIT_COMMITTER_EMAIL= git commit -m "Minimal Repo For Haskell.Nix" --author 'No One <>'
266259
'';
267260
in {
268261
fetched = src;
269262
location = src;
270263
tag = "minimal";
271-
subdirs =
272-
builtins.concatLists (
273-
pkgs.lib.lists.zipListsWith
274-
(n: dep:
275-
builtins.map (d: "dep${builtins.toString n}/" + d) dep.subdirs
276-
)
277-
(pkgs.lib.lists.range 0 ((builtins.length extraSources) - 1))
278-
extraSources
279-
);
264+
subdirs = source.subdirs;
280265
};
266+
extraSourceRepos = if extraSources == null then [] else (builtins.map extraSourceRepo extraSources);
281267

282268
# we need the repository content twice:
283269
# * at eval time (below to build the fixed project file)
@@ -289,9 +275,9 @@ let
289275
# and, say, a linux release build job can identify the derivation
290276
# as built by a darwin builder, and fetch it from a cache
291277
sourceReposEval = builtins.map (fetchPackageRepo pkgs.evalPackages.fetchgit) sourceRepoPackageResult.sourceRepos
292-
++ pkgs.lib.optional (extraSources != null) extraSourceRepo;
278+
++ extraSourceRepos;
293279
sourceReposBuild = builtins.map (x: (fetchPackageRepo pkgs.fetchgit x).fetched) sourceRepoPackageResult.sourceRepos
294-
++ pkgs.lib.optional (extraSources != null) extraSourceRepo.fetched;
280+
++ (builtins.map (x: x.fetched) extraSourceRepos);
295281
in {
296282
sourceRepos = sourceReposBuild;
297283
inherit (repoResult) repos extra-hackages;

0 commit comments

Comments
 (0)