Skip to content

Commit 41fd5e6

Browse files
committed
Add project.plan-nix.freeze
Issues with `cabal.project.freeze` files can be tricky to debug. While it is possible to run without a freeze file and look at the `plan-nix` or `plan-nix.json` (the `plan.json`) created when haskell.nix configured the project, it would be nice to also have the output of `cabal freeze` as it will be in the correct format and contains a different subset of `plan.json` than the `plan-nix`. This might also be useful for automating updating of `.freeze` files.
1 parent 283f573 commit 41fd5e6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ let
385385
LANG = "en_US.UTF-8";
386386
meta.platforms = pkgs.lib.platforms.all;
387387
preferLocalBuild = false;
388-
outputs = ["out" "json"];
388+
outputs = ["out" "json" "freeze"];
389389
} ''
390390
tmp=$(mktemp -d)
391391
cd $tmp
@@ -421,6 +421,7 @@ let
421421
${pkgs.lib.optionalString (cabalProjectFreeze != null) ''
422422
cp ${pkgs.evalPackages.writeText "cabal.project.freeze" cabalProjectFreeze} \
423423
cabal.project.freeze
424+
chmod +w cabal.project.freeze
424425
''}
425426
export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
426427
export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
@@ -436,7 +437,7 @@ let
436437
index-state = cached-index-state;
437438
sha256 = index-sha256-found;
438439
}
439-
} cabal v2-configure \
440+
} cabal v2-freeze \
440441
--index-state=${
441442
# Setting the desired `index-state` here in case it was not
442443
# from the cabal.project file. This will further restrict the
@@ -453,6 +454,10 @@ let
453454
"--ghcjs --with-ghcjs=js-unknown-ghcjs-ghc --with-ghcjs-pkg=js-unknown-ghcjs-ghc-pkg"} \
454455
${configureArgs}
455456
457+
cp cabal.project.freeze $freeze
458+
# Not needed any more (we don't want it to wind up in the $out hash)
459+
rm cabal.project.freeze
460+
456461
mkdir -p $out
457462
458463
# ensure we have all our .cabal files (also those generated from package.yaml) files.

0 commit comments

Comments
 (0)