@@ -385,7 +385,11 @@ let
385 LANG = "en_US.UTF-8";
385 LANG = "en_US.UTF-8";
386 meta.platforms = pkgs.lib.platforms.all;
386 meta.platforms = pkgs.lib.platforms.all;
387 preferLocalBuild = false;
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`
390 tmp=$(mktemp -d)
394 tmp=$(mktemp -d)
@@ -421,10 +425,15 @@ let
421 ${pkgs.lib.optionalString (cabalProjectFreeze != null) ''
425 ${pkgs.lib.optionalString (cabalProjectFreeze != null) ''
422 cp ${pkgs.evalPackages.writeText "cabal.project.freeze" cabalProjectFreeze} \
426 cp ${pkgs.evalPackages.writeText "cabal.project.freeze" cabalProjectFreeze} \
423 cabal.project.freeze
427 cabal.project.freeze
428+ chmod +w cabal.project.freeze
425 export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
430 export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
426 export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
431 export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
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 echo "Using index-state ${index-state-found}"
437 echo "Using index-state ${index-state-found}"
430 # This creates `.cabal` directory that is as it would have
439 # This creates `.cabal` directory that is as it would have
@@ -436,7 +445,7 @@ let
436 index-state = cached-index-state;
445 index-state = cached-index-state;
437 sha256 = index-sha256-found;
446 sha256 = index-sha256-found;
439− } cabal v2-configure \
448+ } cabal v2-freeze \
440 --index-state=${
449 --index-state=${
441 # Setting the desired `index-state` here in case it was not
450 # Setting the desired `index-state` here in case it was not
442 # from the cabal.project file. This will further restrict the
451 # from the cabal.project file. This will further restrict the
@@ -453,6 +462,10 @@ let
453 "--ghcjs --with-ghcjs=js-unknown-ghcjs-ghc --with-ghcjs-pkg=js-unknown-ghcjs-ghc-pkg"} \
462 "--ghcjs --with-ghcjs=js-unknown-ghcjs-ghc --with-ghcjs-pkg=js-unknown-ghcjs-ghc-pkg"} \
454 ${configureArgs}
463 ${configureArgs}
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
456 mkdir -p $out
469 mkdir -p $out
458 # ensure we have all our .cabal files (also those generated from package.yaml) files.
471 # ensure we have all our .cabal files (also those generated from package.yaml) files.