|
385 | 385 | LANG = "en_US.UTF-8";
|
386 | 386 | meta.platforms = pkgs.lib.platforms.all;
|
387 | 387 | preferLocalBuild = false;
|
388 |
| - outputs = ["out" "json"]; |
| 388 | + outputs = [ |
| 389 | + "out" # The results of plan-to-nix |
| 390 | + "json" # The `plan.json` file generated by cabal and used for `plan-to-nix` input |
| 391 | + "freeze" # The `cabal.project.freeze` file created by `cabal v2-freeze` |
| 392 | + ]; |
389 | 393 | } ''
|
390 | 394 | tmp=$(mktemp -d)
|
391 | 395 | cd $tmp
|
@@ -421,10 +425,15 @@ let
|
421 | 425 | ${pkgs.lib.optionalString (cabalProjectFreeze != null) ''
|
422 | 426 | cp ${pkgs.evalPackages.writeText "cabal.project.freeze" cabalProjectFreeze} \
|
423 | 427 | cabal.project.freeze
|
| 428 | + chmod +w cabal.project.freeze |
424 | 429 | ''}
|
425 | 430 | export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
|
426 | 431 | export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
|
427 | 432 |
|
| 433 | + # Using `cabal v2-freeze` will configure the project (since |
| 434 | + # it is not configured yet), taking the existing `cabal.project.freeze` |
| 435 | + # file into account. Then it "writes out a freeze file which |
| 436 | + # records all of the versions and flags that are picked" (from cabal docs). |
428 | 437 | echo "Using index-state ${index-state-found}"
|
429 | 438 | HOME=${
|
430 | 439 | # This creates `.cabal` directory that is as it would have
|
|
436 | 445 | index-state = cached-index-state;
|
437 | 446 | sha256 = index-sha256-found;
|
438 | 447 | }
|
439 |
| - } cabal v2-configure \ |
| 448 | + } cabal v2-freeze \ |
440 | 449 | --index-state=${
|
441 | 450 | # Setting the desired `index-state` here in case it was not
|
442 | 451 | # from the cabal.project file. This will further restrict the
|
|
453 | 462 | "--ghcjs --with-ghcjs=js-unknown-ghcjs-ghc --with-ghcjs-pkg=js-unknown-ghcjs-ghc-pkg"} \
|
454 | 463 | ${configureArgs}
|
455 | 464 |
|
| 465 | + cp cabal.project.freeze $freeze |
| 466 | + # Not needed any more (we don't want it to wind up in the $out hash) |
| 467 | + rm cabal.project.freeze |
| 468 | +
|
456 | 469 | mkdir -p $out
|
457 | 470 |
|
458 | 471 | # ensure we have all our .cabal files (also those generated from package.yaml) files.
|
|
0 commit comments