Skip to content

Replace Nix tooling & update toolchain#6046

Merged
aryairani merged 20 commits intounisonweb:trunkfrom
sellout:replace-nix-tooling
Feb 5, 2026
Merged

Replace Nix tooling & update toolchain#6046
aryairani merged 20 commits intounisonweb:trunkfrom
sellout:replace-nix-tooling

Conversation

@sellout
Copy link
Contributor

@sellout sellout commented Dec 11, 2025

This replaces haskell.nix with stacklock2nix, and brings everything up to Nixpkgs 25.11 and Stackage LTS 24.21 (GHC 9.10.3).

It also adds documentation for how to upgrade tooling in future.

This is an alternative to #6033 + #5914.

Implementation approach and notes

The first commit switches the infrastructure from haskell.nix to stacklock2nix. The latter is much simpler, but less flexible. We took advantage of none of the flexibility of haskell.nix (nor do I think there’s any reason to), but we had a lot of overhead and complexity due to it.

However, it’s difficult to switch the infrastructure without also updating the other tooling (Stack, GHC, etc.), so the remainder of the PR is largely about supporting the new tooling, mostly the upgrade from GHC 9.6.5 to 9.10.3.

Loose ends

x-partial is a newly-introduced custom warning that has been applied to head, etc. I temporarily downgraded it from an error (because we use -Werror) to a warning. I have changes that allow us to restore it to an error again, but I think it’s better as a separate PR because it requires threading a lot of changes.

unison-runtime:optchecks is failing. @dolio is tracking that at nomeata/inspection-testing#100.

@sellout sellout force-pushed the replace-nix-tooling branch 7 times, most recently from bbd54ca to 77fca19 Compare December 15, 2025 06:22
@sellout
Copy link
Contributor Author

sellout commented Dec 15, 2025

@ChrisPenner This PR upgrades us to GHC 9.10 … and I think the compiler must be doing something differently somewhere, because the optchecks stuff is failing with effectively no change to unison-runtime. Maybe it just needs more of that throwIO workaround or something, but thought you might have a clue to offer.

@sellout sellout force-pushed the replace-nix-tooling branch from 77fca19 to 0a324a9 Compare December 23, 2025 22:34
@sellout sellout force-pushed the replace-nix-tooling branch 2 times, most recently from e5e515c to 2b3784b Compare January 6, 2026 22:41
@sellout sellout marked this pull request as ready for review January 6, 2026 22:51
@sellout sellout requested a review from a team as a code owner January 6, 2026 22:51
@aryairani
Copy link
Contributor

unison-runtime:optchecks is failing, and I’m not sure why. Would love some assistance with this one.

@dolio If you might have an idea on this; possibly due to ghc version change?

@dolio
Copy link
Contributor

dolio commented Jan 7, 2026

That test checks that GHC is generating code that looks properly optimized. I think it basically checks that the eval function contains no mention of the Stack type.

So, the details of the optimization have changed. I guess you could try running benchmarks before and after to see if the difference actually matters. If it doesn't, then maybe we need a different test. But if it does, we need to figure out how to fix the performance. Even if it doesn't, it might be easier to tweak something to satisfy the check than to figure out a new check that's actually proper.

@sellout sellout force-pushed the replace-nix-tooling branch from 2b3784b to b78c7f0 Compare January 7, 2026 23:04
@sellout
Copy link
Contributor Author

sellout commented Jan 7, 2026

Here’s the Nix workflow run on my fork: https://github.com/sellout/unison/actions/runs/20785608716 (it’ll run on trunk in this repo when this PR is merged).

Copy link
Contributor

@ceedubs ceedubs left a comment

Choose a reason for hiding this comment

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

I think that the docs for building with cabal need to either switch back to project-file or need to otherwise give a working command (perhaps moving cabal files out of contrib or suggest adding a symlink). Otherwise this is working well for me.

@sellout sellout force-pushed the replace-nix-tooling branch from b78c7f0 to bca81de Compare January 9, 2026 19:19
@sellout
Copy link
Contributor Author

sellout commented Jan 9, 2026

I think that the docs for building with cabal need to either switch back to project-file or need to otherwise give a working command (perhaps moving cabal files out of contrib or suggest adding a symlink). Otherwise this is working well for me.

I removed the commit with the Cabal doc changes. I prefer the shorter --project-dir=contrib over --project-file=contrib/cabal.project, and I like the paths to be relative to the file they’re in … but it breaks the ln -s contrib/* ./ workaround, which is nice for people who are using Cabal regularly.

@sellout
Copy link
Contributor Author

sellout commented Jan 9, 2026

NB: An annoying thing here is that because of the way the Cabal workflow works (in order to allow forks to make comments on PRs), it’s going to fail until after this is merged – it uses the workflow file from the target branch (trunk), and that means it gets the old GHC (& Cabal) version.

Copy link
Contributor

@ceedubs ceedubs left a comment

Choose a reason for hiding this comment

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

Can't claim that I've reviewed the Haskell changes, but the Nix changes seem good to me 👍

@aryairani
Copy link
Contributor

Ok but the current build failures aren't nix related right?
They're something weird about the optimization checks that needs to get fixed for ghc 9.10.3; so not currently mergeable.

@sellout
Copy link
Contributor Author

sellout commented Jan 12, 2026

@dolio I tried running the benchmarks, but they don’t seem to build

⚙️   Processing stanza 1 of 15.
  ❓

    An error occurred while running the following file: unison-src/transcripts-manual/benchmarks.md

    ``` ucm :hide
    > pull unison.public.base.releases.M4d base
    > pull runarorama.public.sort.data sort
    ```

    🛑

    The transcript failed due to an error in the stanza above. The error is:

    ```
    I think you want to merge unison.public.base.releases.M4d into
    the base branch, but it doesn't exist. If you want, you can
    create it with `branch.empty base`, and then `pull` again.
    ```

At first I thought I was just doing something wrong, but I’ve had the same thing happen on various releases. Granted, it’s still possibly I’m doing something wrong. I‘m now seeing if it works for me at the point the benchmarks were last updated. If not, then it’s very likely I’m doing something wrong.

Either way, the benchmarks should probably be run as part of CI. We don’t need to actually measure them in CI (GitHub is no good for that), but at least ensure they build, so then I’d immediately know what I’m doing wrong.

@aryairani
Copy link
Contributor

aryairani commented Jan 12, 2026

> pull unison.public.base.releases.M4d base

This is ancient syntax, so those aren't the right benchmarks. Those should be updated or deleted.

@dolio what are the right benchmarks that @sellout should run? Is unison-src/transcripts-manual/benchmarks.md a thing? Or, can you coordinate with them, thanks.

That test checks that GHC is generating code that looks properly optimized. I think it basically checks that the eval function contains no mention of the Stack type.

So, the details of the optimization have changed. I guess you could try running benchmarks before and after to see if the difference actually matters. If it doesn't, then maybe we need a different test. But if it does, we need to figure out how to fix the performance. Even if it doesn't, it might be easier to tweak something to satisfy the check than to figure out a new check that's actually proper.

@dolio
Copy link
Contributor

dolio commented Jan 12, 2026

The benchmarks are on share

https://share.unison-lang.org/@pchiusano/misc-benchmarks

run suite after pulling.

I don't actually remember what is in the benchmark transcript.

There was a comment about this before, but the failure caused by having
both GHC 9.10.3 and 9.6.5 HIE files in the GitHub actions cache made it
worth addressing now. This also works around another bug introduced in
Weeder 1.9.0.
Deep file creation was causing tests to modify files in `$HOME`, which was exposed by Nix sandboxing. This moves the
file creation out a bit so that test code can specify an alternative location (alongside the test codebase).

I’m not sure this is the right level – should we just not manage credentials during a test? Have a null manager? And
this really should be moved up even further.
__NB__: The hpack binary in Nixpkgs is for 0.38.3, but the library
        Stack is built against is 0.38.1 for some reason.
Also enable it on aarch64-linux for the first time.

Fixes unisonweb#5789.
This switches back to `-Werror=deprecations`, replacing all the
deprecated calls flagged in this upgrade.
@sellout sellout force-pushed the replace-nix-tooling branch from ca362aa to 2760a4c Compare February 3, 2026 22:39
@github-actions
Copy link

github-actions bot commented Feb 3, 2026

Some tests with 'continue-on-error: true' have failed:

  • Cabal / smoke-test

Created by continue-on-error-comment

@sellout
Copy link
Contributor Author

sellout commented Feb 3, 2026

@aryairani This should be ready for review now.

@sellout sellout requested a review from aryairani February 3, 2026 23:49
@dolio
Copy link
Contributor

dolio commented Feb 4, 2026

BTW, the response I received about the inspection testing thing was that it's actually possible for the mere presence of the inspection test to change the way GHC optimizes things. So that may be what we're seeing. But I'm not sure there's a concrete solution. The actual inspection test doesn't directly refer to the thing being optimized, so it's not anything as 'simple' as that.

@aryairani
Copy link
Contributor

I'm scared but here goes

@aryairani aryairani merged commit 79a722d into unisonweb:trunk Feb 5, 2026
18 checks passed
@mitchellwrosen
Copy link
Member

@sellout I'm seeing a new error that you might know something about. Now when I run git in this repo (with config picked up by use flake in .envrc), I get:

warning: unhandled Platform key FamilyDisplayName
error: tool 'git' not found

I still see git on my path, it's at /usr/bin/git, but running it prints these lines for some reason. I'm on macOS (Intel). Any ideas?

@aryairani
Copy link
Contributor

@mitchellwrosen Oh, yeah I encountered this last night too, this line 50 here should fix it.

95a3ec8#diff-8b67b4b0f775a1335829ea1852b4f6cd3a88983f051a2676f208ce6acd942c26

@sellout
Copy link
Contributor Author

sellout commented Feb 5, 2026

@mitchellwrosen I haven’t seen that.

@aryairani For some reason, that link doesn’t show me anything helpful (or at least not obvious enough) – can you share the line contents?

I did a bit of poking around and noticed that the other message (warning: unhandled Platform key FamilyDisplayName) is maybe due to an interaction between some Nixpkgs 25.11 revisions and the Xcode-provided git on macOS (NixOS/nixpkgs#376958) updating the flake (or your system’s Nixpkgs?) might get rid of that one.

@sellout sellout deleted the replace-nix-tooling branch February 5, 2026 17:54
@aryairani
Copy link
Contributor

aryairani commented Feb 5, 2026

@sellout @mitchellwrosen Sorry about that, here's the contents
image

I did a bit of poking around and noticed that the other message (warning: unhandled Platform key FamilyDisplayName) is maybe due to an interaction between some Nixpkgs 25.11 revisions and the Xcode-provided git on macOS (NixOS/nixpkgs#376958) updating the flake (or your system’s Nixpkgs?) might get rid of that one.

Maybe this would be better than adding it how I did (I should be able to use my system provided binaries too, IMO), but I'm not sure what it's suggesting to do about it.

@mitchellwrosen
Copy link
Member

Ah ha! Ok yeah, using git from nixpkgs 25.11 solved the problem. I think we want Arya's patch too so others don't hit this.

@sellout
Copy link
Contributor Author

sellout commented Feb 5, 2026

@aryairani Weird – don’t know why my browser didn’t jump to that line.

Yeah, I do like keeping my flakes as self-contained as possible. For example, adding a home-manager input when I have homeModules or homeConfigurations in the flake and Nix even itself (although that one is a bit of a catch-22). git seems a bit more outside, but I think this issue justifies its place in a consistent environment (so yeah, keep @aryairani’s patch).

@aryairani
Copy link
Contributor

Ok cool. We can always pull it later if we figure out a better solution.

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