You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There should be one freeze file per GHC version (like there is a build directory per GHC version in v2-cabal). Otherwise, freeze does not work as expected in a multi-GHC environment. I expect cabal v2-freeze -w ghc-x.y.z to work analogously to cabal v2-build -w ghc-x.y.z.
I agree, freeze file makes mostly sense for single compiler only.
This is challenging. Freeze file is just a convention, it's not "special". It is an unrestricted appendix to cabal.project (hardcoded like cabal.project.include). So this feature request is not much different then asking to select different cabal.project files based on --with-compiler flag. This is even more challenging then builddir in cabal.project (#5271), but the reason is the same: compiler can be set in cabal.project with with-compiler: ....
I'm afraid that project configuration have to be reworked in some non-trivial way to support this.
EDIT: an important constraint is that project configuration can be read in <10ms, to guarantee interactive-fast responses for no-build-op operations (e.g. cabal list-bin). Otherwise people (including myself) will loudly complain about why cabal-install become slow.
By the way, the freeze file can be changed, just together with the main project file: --project-file affects all kinds of project files together, so using --project-file=cabal.project.ghc-x.y would make cabal pick up a cabal.project.ghc-x.y.freeze (and cabal.project.ghc-x.y.local) file.
This might be a nuisance when the project file is big and has to be copied multiple times, but it works, and symlinks can solve the duplication
I think that explicit includes (discussed on related ticket) plus allowing includes in conditional stanzas would give a way to do this, albeit not the most seamless ux for it.
Just wanted to note that it's not enough to have one per compiler version, it can also vary per platform. So in principle you need one per compiler-version/platform combination.
It can also vary based on the output of pkg-config. IMHO this can be left to the user. I have seen many projects have separate project files per compiler version, so it's not impossible.
Another option is to have one project per GHC version. Each would then be individually freezable.
That's what Updo does with its cabal.project for the current GHC version and its cabal.upgrade.project when upgrading to another GHC version. If more versions are required than current (default) and upgrade then Updo can generate GHC-prefixed projects.
Activity
phadej commentedon Apr 22, 2021
I agree, freeze file makes mostly sense for single compiler only.
This is challenging. Freeze file is just a convention, it's not "special". It is an unrestricted appendix to
cabal.project(hardcoded likecabal.project.include). So this feature request is not much different then asking to select differentcabal.projectfiles based on--with-compilerflag. This is even more challenging thenbuilddirincabal.project(#5271), but the reason is the same: compiler can be set incabal.projectwithwith-compiler: ....I'm afraid that project configuration have to be reworked in some non-trivial way to support this.
EDIT: an important constraint is that project configuration can be read in <10ms, to guarantee interactive-fast responses for no-build-op operations (e.g.
cabal list-bin). Otherwise people (including myself) will loudly complain about whycabal-installbecome slow.fgaz commentedon May 3, 2021
We could partially get there by adding a
--freeze-fileflag that works like the--project-fileonefgaz commentedon Jun 21, 2021
By the way, the freeze file can be changed, just together with the main project file:
--project-fileaffects all kinds of project files together, so using--project-file=cabal.project.ghc-x.ywould make cabal pick up acabal.project.ghc-x.y.freeze(andcabal.project.ghc-x.y.local) file.This might be a nuisance when the project file is big and has to be copied multiple times, but it works, and symlinks can solve the duplication
jneira commentedon Jun 21, 2021
only want to note that symlinking in windows is not reliable in general
gbaz commentedon Aug 26, 2021
I think that explicit includes (discussed on related ticket) plus allowing includes in conditional stanzas would give a way to do this, albeit not the most seamless ux for it.
andreabedini commentedon May 15, 2023
After getting explicit includes and
cabal freeze -w; is there anything left to this ticket or it can it be close?michaelpj commentedon May 16, 2023
Just wanted to note that it's not enough to have one per compiler version, it can also vary per platform. So in principle you need one per compiler-version/platform combination.
andreabedini commentedon May 17, 2023
It can also vary based on the output of
pkg-config. IMHO this can be left to the user. I have seen many projects have separate project files per compiler version, so it's not impossible.philderbeast commentedon Apr 23, 2024
This is already possible using imports1;
Then edit the project to import the compiler-specific freeze file guarded by a conditional;
Footnotes
This was already suggested on [nix-local-build] Allow specifying freeze file for other commands #3587 in https://github.com/haskell/cabal/issues/3587#issuecomment-234773265 and https://github.com/haskell/cabal/issues/3587#issuecomment-234788956. That same issue also notes it is also "difficult to support multiple compiler versions in a project" but this was before conditionals in projects, wasn't it? ↩
philderbeast commentedon Apr 23, 2024
We could add this to the cookbook section on reproducible builds.
philderbeast commentedon Apr 23, 2024
Another option is to have one project per GHC version. Each would then be individually freezable.
That's what Updo does with its
cabal.projectfor the current GHC version and itscabal.upgrade.projectwhen upgrading to another GHC version. If more versions are required than current (default) and upgrade then Updo can generate GHC-prefixed projects.