@@ -530,12 +530,12 @@ let
530530 index-state = cached-index-state;
531531 sha256 = index-sha256-found;
532532 }
533− } cabal v2-freeze \
534− --index-state=${
535− # Setting the desired `index-state` here in case it was not
536− # from the cabal.project file. This will further restrict the
537− # packages used by the solver (cached-index-state >= index-state-found).
538− index-state-found} \
533+ } cabal v2-freeze ${
534+ # Setting the desired `index-state` here in case it is not
535+ # in the cabal.project file. This will further restrict the
536+ # packages used by the solver (cached-index-state >= index-state-found).
537+ pkgs.lib.optionalString (index-state != null) "--index-state=${index-state}"
538+ } \
539539 -w ${
540540 # We are using `-w` rather than `--with-ghc` here to override
541541 # the `with-compiler:` in the `cabal.project` file.