@@ -30,7 +30,10 @@ let
30 exactDep = pdbArg: p: ''
30 exactDep = pdbArg: p: ''
31 if id=$(ghc-pkg ${pdbArg} field ${p} id --simple-output); then
31 if id=$(ghc-pkg ${pdbArg} field ${p} id --simple-output); then
32 echo "--dependency=${p}=$id" >> $out/configure-flags
32 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
@@ -53,7 +56,8 @@ let
54 '' + lib.optionalString component.doExactConfig ''
57 '' + lib.optionalString component.doExactConfig ''
55 echo "--exact-configuration" >> $out/configure-flags
58 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
58 ${lib.concatMapStringsSep "\n" (p: exactDep "--package-db ${p.components.library}/package.conf.d" p.identifier.name) component.depends}
62 ${lib.concatMapStringsSep "\n" (p: exactDep "--package-db ${p.components.library}/package.conf.d" p.identifier.name) component.depends}
59 ${lib.concatMapStringsSep "\n" (exactDep "") nonReinstallablePkgs}
63 ${lib.concatMapStringsSep "\n" (exactDep "") nonReinstallablePkgs}