@CMCDragonkai Sorry you’re having some trouble with the Haskell package set. Let me try to answer some of your questions.
It shows that
stm-containersfails becausestm-hamtfails, andstm-hamtfails because it’s dependency constraint is not met specificallyprimitiveandprimitive-extraswhich is still on an older version.
I believe your diagnosis here is correct:
https://hydra.nixos.org/build/98648183/nixlog/2
As a general question I’m quite confused how haskell packages get updated.
The main tool for updating the Haskell package set is hackage2nix.
Also, @peti has weekly streams where he goes through and actually updates the Haskell packages. I think he has uploaded some of them to YouTube as well, so I’d recommend actually watching through one:
I believe hackage2nix is run automatically at regular intervals (once a day)? It pushes an update to the haskell-updates branch. Here is an example of it running:
https://github.com/NixOS/nixpkgs/pull/76982/commits/3741b43294b4d807fc982fa671d3c52065d1ef02
hackage2nix basically looks at two separate sets of information to decide what version of each Haskell package to use:
-
haskellPackagestracks package versions that are available in the latest Stackage LTS. You can see a list of packages and the corresponding versions here:For each of the packages in this list, the corresponding package in
haskellPackagesgets set to this same version.For instance, in the above list, we have
- lens == 4.17.1. If you look athaskellPackages.lens.versionfor nixpkgs in that commit, you’ll see that it is at4.17.1.hackage2nixALSO creates a derivation for the latest package version on Hackage (if they are different).For instance, you’ll notice that the latest version of
lenson Hackage is actually4.18.1.hackage2nixhelpfully createshaskellPackages.lens_4_18_1that we can use as well.Haskell packages that are available in the latest Stackage LTS set are updated semi-automatically by @peti once a week. Here’s an example of this:
https://github.com/NixOS/nixpkgs/pull/76982/commits/bae6c63431301926de5064754236f1e0eb0d3101
-
For Haskell packages not in the latest Stackage LTS,
hackage2nixjust generates the package from the latest version on Hackage.For instance,
stm-containersis not in the latest Stackage LTS, sohackage2nixjust generates the latest version.haskellPackages.stm-containers.versionis currently1.1.0.4on thehaskell-updatesbranch.
You can probably see what the problem will be here. The primitive package is in Stackage LTS as version 0.6.4.0, so haskellPackages.primitive is also 0.6.4.0. However, stm-hamt is not in Stackage LTS, and requires primitive >= 7.0.
There are a couple ways to get stm-hamt to build. You could send a PR to the haskell-updates branch that does any of the following:
-
Override
stm-hamtto explicitly use the newest version ofprimitive. You might have to do something similar forstm-containers:In
pkgs/development/haskell-modules/configuration-common.nix:stm-hamt = super.stm-hamt.override { primitive = self.haskellPackages.primitive_0_7_0_0; primitive-extras = self.haskellPackages.primitive-extras_0_8; };This is basically what you have to do, but I haven’t tested this. (edit: As you can see below, this is not sufficient, although it should give you an idea of basically what needs to be done.)
The bad thing about this method is that at some point, when a new version of
primitiveorprimitive-extrasis released to Hackage,hackage2nixwill remove theprimitive_0_7_0_0andprimitive-extras_0_8derivations. This will cause nixpkgs to not be able to be evaluated, and @peti or I will have to fix it up. This is annoying to do. -
Create an older
stm-hamtderivation.There is a list of packages that will be used to generate older versions of packages from Hackage:
You can see that
- aeson < 0.8is on this list. This means thathackage2nixwill generate a derivation likeaeson_0_7_0_6.You could do something similar for
stm-hamt. Add a line like- stm-hamt ==1.2.0.3. This will causehackage2nixto create thestm-hamt_1_2_0_3package. Then you could create an override like above onstm-containersto usestm-hamt_1_2_0_3instead of the normalstm-hamt.The bad thing about this method is that this
extra-packageslist rarely gets updated when it is no longer needed. For instance, you can see the comment onaeson < 0.8isnewer versions don't work with GHC 7.6.x or earlier. However, nixpkgs has long since dropped support for GHC-7.6. It is unlikely anyone is still using this.Unless you want to be proactive in supporting
stm-hamtandstm-containers, it is likely that it will eventually be broken again in the future. -
Force
stm-hamt(andstm-containers?) to be an older version.You can actually add a line like
- stm-hamt ==1.2.0.3right above the line# LTS Haskell 14.20.This will cause
hackage2nixto generate thehaskellPackages.stm-hamtas version1.2.0.3(and also create ahaskellPackages.stm-hamt_1_2_0_4package, since that is the latest on Hackage).stm-containerswill then pick this up automatically, and hopefully be able to be built.The bad thing about this method is that there is no automatic process to remove the
- stm-hamt ==1.2.0.3line. This could also very easily break in the future. -
Get
stm-hamtandstm-containersinto Stackage. Then we can be sure that they will compile with the existing version ofprimitivein Stackage/nixpkgs.This is by far the easiest for the nixpkgs maintainers, since we often don’t have to do anything. Although it is often the most work for you. And it normally takes a couple months until you can actually use the package you want to use in nixpkgs.
As you can see, Haskell packages in nixpkgs often break if they are not in Stackage LTS.