Skip to content

Conversation

@rowanG077
Copy link
Member

This updates the nix flake to the newest nixos-unstable. Fully updates to the most recent GHC minor version as well as bump the typelit plugins.

@rowanG077 rowanG077 requested a review from jaschutte December 23, 2025 22:09
@rowanG077 rowanG077 force-pushed the nix-ghc-minor-update branch 2 times, most recently from 1ba5d8c to 76353ee Compare December 23, 2025 22:19
@rowanG077
Copy link
Member Author

rowanG077 commented Dec 24, 2025

I also ran into: #2823

in nixpkgs it's also patched out on >=9.6: https://github.com/NixOS/nixpkgs/blob/4cb741a91fd65971689b6272fd1fdc67355cd3e5/pkgs/development/compilers/ghc/ghc-9.6-llvm-use-new-pass-manager.patch

So I applied @christiaanb suggestion to remove it entirely.

@rowanG077 rowanG077 force-pushed the nix-ghc-minor-update branch 3 times, most recently from cf6bc92 to 1b9d874 Compare December 24, 2025 10:56
@jaschutte
Copy link
Contributor

Looks good overall! clash-ffi seems to not build on ghc984 with Nix though. I tried building it locally and it fails there too so it's not a CI bug.

I thought it maybe had to do with the removal of inherit (hfinal) clash-prelude in f6d9393bf297but adding that back Nix complains about having unsolicited arguments passed. Another item of note is that building clash-ffi for other versions doesn't give any errors, but it produces empty folders.

Copy link
Member

@DigitalBrains1 DigitalBrains1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really thought we deliberately didn't use 9.10.3. Also please see #3112 (comment). Without adding it to CI, I really think we can't put it in our flake. And I suspect CI will fail.

[edit]
I'll run GitLab CI on it.
[/edit]

@DigitalBrains1
Copy link
Member

DigitalBrains1 commented Dec 24, 2025

clash-ffi seems to not build on ghc984 with Nix though.

Perhaps it's the ffi-interface-tests test which doesn't work with plain Cabal either?

- GHC_VERSION: 9.8.4
# TODO: remove this when https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406
# is fixed
SKIP_CLASH_FFI_EXAMPLE: "yes"

# TODO: remove this when https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406
# is fixed
rules:
- if: $SKIP_CLASH_FFI_EXAMPLE != "yes"

@DigitalBrains1
Copy link
Member

DigitalBrains1 commented Dec 24, 2025

Heh, silly me. If I would like to test 9.10.3 on GitLab CI, I'd first need to create a Docker image for that.

I'll try a local run.

@martijnbastiaan It wasn't an accident that we did not use 9.10.3, right? Something was up with it? I've forgotten what, but if we'd supported 9.10.3, we'd have done so to stay on Stackage.

[edit]
Hmmmm clash-testsuite locally runs to completion (no Symbiyosys or Modelsim tried). And the test suites for clash-prelude and clash-lib also succeed (but those are also part of GitHub Nix CI, so we knew that already). And yet, I think there was a problem.
[/edit]

[edit 2]
Ah maybe for Stackage we're just not on there due to #3007 ?
[/edit 2]

[edit 3]
ModelSim also passes on clash-testsuite
[/edit 3]

@martijnbastiaan
Copy link
Member

I have no idea @DigitalBrains1, sorry. It wouldn't surprise me if it was deliberate though, every other GHC release seems to be broken in some way.

@DigitalBrains1
Copy link
Member

DigitalBrains1 commented Dec 25, 2025

Maybe I'm just mixing stuff up with GHC 9.12, though.

GHC 9.12 is broken for us, and that is why we are not in Stackage nightly. But I'm not sure what the situation is for 9.10.

I think we can switch to 9.10.3, provided we add it to GitLab CI, because we want to know when we break something.

@christiaanb Do you agree? Or do you remember why we're still on 9.10.2?

@martijnbastiaan
Copy link
Member

IMO just do it. If it didn't work, we should have left a note..

@DigitalBrains1
Copy link
Member

Right, I wasn't very explicit, but I also meant, let's upgrade to 9.10.3.

@DigitalBrains1
Copy link
Member

By the way, I'm going to do a Hackage revision of clash-prelude and clash-lib v1.8.4 to also allow doctest-parallel v0.4. I've asked our GitLab CI nicely to test this change for me, and if it is happy about it (I really expect it will be), I'll do that.

That way, we can get into Stack LTS 24 without any fussing about with disabling tests because the version is out-of-bounds.

Which brings me to this question: we're going to backport this PR to 1.8, right? Our own downstream projects use the flake from the stable Clash release, so it'd be good to get this change into an upcoming stable release. We definitely don't want the next release to shrink its bounds on doctest-parallel :-). If this PR can and should be backported, could you add the backport 1.8 label?

@DigitalBrains1
Copy link
Member

@rowanG077 , I've created a branch peter/nix-ghc-minor-update where I did all the things needed to bump to 9.10.3 in CI. I created and published new Docker images, which is the major part of it. I also noted that the script wasn't updated to drop old versions of GHC we no longer support in master, so I yanked them as well.

I suggest you include the commit in this PR.

Of course, the [skip ci] commit at the HEAD is not part of it; it's just to prevent GitLab CI from running costly CI for no purpose. It's especially costly because the changes to CI affect caching.

BTW, the backport to 1.8 of this PR will need some more work for the changes to CI. I'll do that as well (it's not much work if you've done it before); just don't expect a backport to work right away.

@rowanG077
Copy link
Member Author

@DigitalBrains1 Awesome! Will take a look at this later this week and finalize this!

@rowanG077 rowanG077 force-pushed the nix-ghc-minor-update branch from 1b9d874 to da40b2e Compare December 29, 2025 14:03
Copy link
Member

@DigitalBrains1 DigitalBrains1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My requested changes have been taken care of, approved.

However, I think you will still need to do something about 9.8.4 on Nix. I suspect ffi-interface-tests is your culprit #3112 (comment).

@rowanG077 rowanG077 force-pushed the nix-ghc-minor-update branch from da40b2e to a103740 Compare December 30, 2025 10:20
@rowanG077
Copy link
Member Author

rowanG077 commented Dec 30, 2025

The reason the clash-ffi build succeeds on GHC 9.10.3 and not on GHC 9.8.4 seems to be that cabal errors on empty package definition with the cabal that is used with GHC 9.8.4 but no longer with GHC 9.10.3.

What I have done now is marked clash-ffi broken on the GHC version that it doesn't function on in nix as well and removed the builds from the matrix in CI.

@jaschutte To do this I had to change the order of the overlays. With ghcOverlay first there was no way to mark clash-ffi broken only on some specific GHC version. I don't think this has further impact for us but I'd like you to confirm that!

I think if @jaschutte is oke with this and CI passes it can be merged.

@rowanG077 rowanG077 force-pushed the nix-ghc-minor-update branch from 08e1ee0 to bf88deb Compare December 30, 2025 10:26
@rowanG077 rowanG077 force-pushed the nix-ghc-minor-update branch from bf88deb to feb0ff3 Compare December 30, 2025 12:05
@rowanG077
Copy link
Member Author

rowanG077 commented Dec 30, 2025

Scratch that, It seems that clash-ffi has no problem running on 9.8.4 or 9.10.3 (fingers crossed for CI), so I have:

  • Removed the guards on buildable in the clash-ffi cabal file.
  • Transformed the test executable to a proper test-suite so nix picks it up and runs it. I couldn't dig up a reason it originally was a bare executable, do you know @kleinreact?
  • Removed the CI logic that skips clash-ffi on the apparently not broken versions.

There seems to be no reason this was not a test-suite
to begin with. Making it a test-suite makes it
automatically build and ran for nix builds of
clash-ffi.
@rowanG077 rowanG077 force-pushed the nix-ghc-minor-update branch from 7774a32 to 973e91a Compare December 30, 2025 12:18
@kleinreact
Copy link
Member

Transformed the test executable to a proper test-suite so nix picks it up and runs it. I couldn't dig up a reason it originally was a bare executable, do you know @kleinreact?

I don't remember the exact issue, but it was some problem with adding C sources as part of the test-suite. Happy to hear if the issue got fixed such that we can convert it to a proper test-suite now.

-- TODO: remove this once https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406
-- is fixed
if impl(ghc < 9.8.3) || impl(ghc == 9.10.1)
if impl(ghc < 9.8.3) || impl(ghc == 9.10.1) || impl(ghc > 9.10.2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not:

if impl(ghc < 9.8.3) || impl(ghc >= 9.10.1)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because GHC 9.10.2 has the issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course we could do

if impl(ghc < 9.8.3) || impl(ghc > 9.10.2)

and just ignore the fact that 9.10.1 would actually work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, perhaps we should reverse the logic and do:

-- GHC 9.8.4 and 9.10.2 have issues, see https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406
if impl(ghc == 9.8.4) || impl(ghc == 9.10.2)
  buildable: False
else
  buildable: True

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're thinking nobody will be trying 9.8.3 anymore? In that case, it would indeed match everything in practice.

What happened to 9.8.3? :-) Do you know why it was pulled from GHCup? I couldn't find anything at a really quick glance, and my dinner is cooling.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry, I missed that 9.8.3 also has the bug... so yeah, then it would be:

-- GHC 9.8.3, 9.8.4 and 9.10.2 have issues, see https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406
if impl(ghc == 9.8.3) || impl(ghc == 9.8.4) || impl(ghc == 9.10.2)
  buildable: False
else
  buildable: True

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we can just leave the logic as is, but update the comment to specify which GHCs are affected

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine by me! What do we do with

-- TODO: remove this once https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406
-- is fixed

I'm not sure what it suggests we do, but I think it's saying: once GHC 9.8 and GHC 9.10 both have received a minor version update that fixes the bug, remove this stanza. I wonder whether that would even be a good idea.

Also, after reading the discussion about 9.8.3 I linked to in my previous message, I doubt there will ever be another 9.8 release.

You wrote the comment; what did you intend?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I meant that when a fix was released, we should properly fix the bounds. The original version didn’t allow building on e.g. GHC 9.12

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I've updated the comments from

-- TODO: remove this once https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406
-- is fixed

to

-- GHC 9.8.3, 9.8.4 and 9.10.2 have issues, see https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406

I note that in .ci/build.sh the phrasing was a bit different:

# TODO: remove this and put it back into tests when
# https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406
# is fixed

I think it'll be quite a while before we can actually put it back into tests; I suppose that will be once we drop 9.8 support from Clash. In the interest of clarity and maintainability, I've rewritten it a bit so it doesn't duplicate shell code and is easier to grok.

Are you satisfied with how it is now, @christiaanb ?

-- TODO: remove this once https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406
-- is fixed
if impl(ghc < 9.8.3) || impl(ghc == 9.10.1)
if impl(ghc < 9.8.3) || impl(ghc == 9.10.1) || impl(ghc > 9.10.2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not

if impl(ghc < 9.8.3) || impl(ghc >= 9.10.1)

@jaschutte
Copy link
Contributor

@jaschutte To do this I had to change the order of the overlays. With ghcOverlay first there was no way to mark clash-ffi broken only on some specific GHC version. I don't think this has further impact for us but I'd like you to confirm that!

Nope! That should be good. I don't know what depends on clash-ffi and if marking that broken causes anything bad, but the overlay change should be fine!

Just to be sure I nix build clash-protocols with this version of clash-compiler, which seems to evaluate fine at least. It fails compilation due to wrong dependency versions but that's unrelated to this PR. Tldr; this is fine by me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants