@@ -30,7 +30,10 @@ let
3030 exactDep = pdbArg: p: ''
3131 if id=$(ghc-pkg ${pdbArg} field ${p} id --simple-output); then
3232 echo "--dependency=${p}=$id" >> $out/configure-flags
33− # TODO: Figure out how to do this for cabal.config for nix-shell
33+ fi
34+ if ver=$(ghc-pkg ${pdbArg} field ${p} version --simple-output); then
35+ echo "constraint: ${p} == $ver" >> $out/cabal.config
36+ echo "constraint: ${p} installed" >> $out/cabal.config
3437 fi
3538 '';
3639
@@ -53,7 +56,8 @@ let
5356
5457 '' + lib.optionalString component.doExactConfig ''
5558 echo "--exact-configuration" >> $out/configure-flags
56− echo "exact-configuration: True" >> $out/cabal.config
59+ echo "allow-newer: ${package.identifier.name}:*" >> $out/cabal.config
60+ echo "allow-older: ${package.identifier.name}:*" >> $out/cabal.config
5761
5862 ${lib.concatMapStringsSep "\n" (p: exactDep "--package-db ${p.components.library}/package.conf.d" p.identifier.name) component.depends}
5963 ${lib.concatMapStringsSep "\n" (exactDep "") nonReinstallablePkgs}