Skip to content

Commit 173bd3b

Browse files
Try #1660:
2 parents 6c7f9d0 + bb7c196 commit 173bd3b

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

overlays/haskell.nix

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -257,37 +257,38 @@ final: prev: {
257257
'';
258258
};
259259
# This is very big, and cheap to build: prefer building it locally
260-
tarballRepos = final.runCommand dotCabalName { nativeBuildInputs = [ cabal-install dummy-ghc dummy-ghc-pkg ]; preferLocalBuild = true; } ''
260+
tarballRepoFor = name: index: final.runCommand "tarballRepo_${name}" {
261+
nativeBuildInputs = [ cabal-install dummy-ghc dummy-ghc-pkg ];
262+
} ''
263+
set -xe
264+
261265
mkdir -p $out/.cabal
262266
cat <<EOF > $out/.cabal/config
263-
${final.lib.concatStrings (
264-
final.lib.mapAttrsToList (name: index:
265-
''
266267
repository ${name}
267268
url: file:${mkLocalHackageRepo { inherit name index; }}
268269
secure: True
269270
root-keys:
270271
key-threshold: 0
271272
272-
'') allTarballs
273-
)}
274273
EOF
275274
276275
# All repositories must be mkdir'ed before calling new-update on any repo,
277276
# otherwise it fails.
278-
${final.lib.concatStrings (map (name: ''
279-
mkdir -p $out/.cabal/packages/${name}
280-
'') (builtins.attrNames allTarballs))}
277+
mkdir -p $out/.cabal/packages/${name}
281278
282-
${final.lib.concatStrings (map (name: ''
283-
HOME=$out cabal new-update ${name}
284-
'') (builtins.attrNames allTarballs))}
279+
HOME=$out cabal new-update ${name}
285280
'';
281+
f = name: index:
282+
let x = tarballRepoFor name index; in
283+
''
284+
ln -s ${x}/.cabal/packages/${name} $out/.cabal/packages/${name}
285+
cat ${x}/.cabal/config >> $out/.cabal/config
286+
'';
286287
in
287288
# Add the extra-hackage-repos where we have all the files needed.
288289
final.runCommand dotCabalName { nativeBuildInputs = [ final.xorg.lndir ]; } ''
289-
mkdir $out
290-
lndir ${tarballRepos} $out
290+
mkdir -p $out/.cabal/packages
291+
${builtins.concatStringsSep "\n" (final.lib.mapAttrsToList f allTarballs)}
291292
292293
${final.lib.concatStrings (final.lib.mapAttrsToList (name: repo: ''
293294
mkdir -p $out/.cabal/packages/${name}

0 commit comments

Comments
 (0)