| 26 Jul 2025 |
emily | well… hopefully all that made things more confusing | 02:00:28 |
emily | anyway, it may be that the Haskell package set gets cross/splicing wrong in ways that make things weird. I've seen some hints of that in the past. not sure though | 02:00:50 |
chreekat | so where does a cross compiler fit into that? (How do you specify Target?) | 04:34:15 |
aidalgol | And then when I have a fix, do I create a PR to marge into haskell-updates? | 04:49:29 |
Alex | In reply to @aidalgol:matrix.org And then when I have a fix, do I create a PR to marge into haskell-updates? Yes | 07:27:06 |
Alex | Leaving out the confusing mess that is splicing, cross starts by setting buildPlatform and hostPlatform differently when initialising Nixpkgs.
Nixpkgs will then produce multiple "layers" of packages.
There are the top-level packages, which run on the host platform and (if applicable) target the host platform.
Under buildPackages i.e. pkgsBuildHost are packages that run on the build platform and (if applicable) target the host platform.
More rarely, you might need to use pkgsBuildBuild for compilers that target the build platform.
Finally, there is targetPackages i.e. pkgsHostTarget for when you're inside buildPackages and need to reference a top-level package.
So with WASM, pkgsCross.wasm32-unknown-none is the top-level layer that builds on your native system and runs on WASM.
pkgsCross.wasm32-unknown-none.ghc is a GHC cross-compiled to run on WASM.
pkgsCross.wasm32-unknown-none.buildPackages.ghc is a GHC cross-compiler that runs on your native system and targets WASM.
pkgsCross.wasm32-unknown-none.pkgsBuildBuild.ghc is a GHC that runs and targets your native system.
pkgsCross.wasm32-unknown-none.haskellPackages.pandoc is Pandoc compiled to run on WASM (i.e. compiled with buildPackages.ghc). | 07:40:16 |
Alex | In reply to @maralorn:maralorn.de I would like to conceptually grok how cross-compilation works in nixpkgs. My understanding is that "buildPackages" is meant to contain build outputs which are meant to be used on the build system, and they can be used to produce build outputs meant to be run on the target system. What I am wondering is this: When we want to cross-compile to wasm then we need to take a ghc which has wasm als compile target. But that ghc I think runs on the build system and thus belongs to buildPackages right? But when we replace the ghc in buildPackages with a wasm-targeting one, then those haskellBuildPackages are kinda broken because they should be compiled for and usable on the build plattform, so "replacing" the ghc is kinda wrong is it?
I am asking because I am trying to understand this line: https://github.com/ners/nix-wasm/blob/795efcfb8f8e98d7084be5da354cbe850f5834da/flake.nix#L48 Which works, but it does e.g. lead to ghcWithPackages not working for wasm cross. buildPackages contains cross-compilers, so that line doesn't look too out of place.
I'm not sure what exactly the haskell.override is doing.
(In my experience, extending prev.haskell without override works, though I was redefining all of compiler and packages.)
The wasm32-wasi-ghc-9_12 doesn't have any passthru attributes, which Nixpkgs needs to do various things correctly.
The author has already realised this by adding targetPrefix to it, but there might be others needed to make ghcWithPackages work. | 08:00:57 |
| oak 🏳️🌈♥️ changed their profile picture. | 08:27:13 |
chreekat | Interesting article on cross compilation in nixpkgs if you haven't seen it https://blog.obsidian.systems/compiler-bootstrapping-in-nixpkgs/ | 08:54:04 |
aleksana 🏳️⚧️ (force me to bed after 18:00 UTC) | In reply to @b:chreekat.net Interesting article on cross compilation in nixpkgs if you haven't seen it https://blog.obsidian.systems/compiler-bootstrapping-in-nixpkgs/ Not cross compiling ghc though 😔 | 14:04:30 |
chreekat | ...yet | 14:15:37 |
sterni (he/him) | maralorn: fyi https://github.com/NixOS/nixpkgs/pull/424162/commits/3ddc9cb90a53f999a1b0c3b4b7a6215973fa6df0 | 20:23:57 |
sterni (he/him) | we should cross compile some bindists before it stops being possible :p | 20:25:18 |
Alex | True, maybe time to try asking around again. | 21:34:49 |
aidalgol | sterni: I figure we should probably take the oama cabal discussion here. Should I just leave it pinned to the old GHC version, or try overriding it with a newer Cabal version, or something else? | 21:55:01 |
aidalgol | Full disclosure, I am not familiar with Haskell tooling, and only maintain oama in nixpkgs because I have a strong need for a working OAUTH credential manager that can use the Secrets Service interface. | 21:56:19 |
| 27 Jul 2025 |
Teo (he/him) | In reply to @sternenseemann:systemli.org we should cross compile some bindists before it stops being possible :p Btw if there's issues the nixpkgs maintainers would like emphasized more, I'm happy to raise things at the GHC meetings. No guarantees that stuff will get prioritised but it might help avoid stuff falling through the cracks | 12:41:23 |
Alex | In reply to @teoc:matrix.org Btw if there's issues the nixpkgs maintainers would like emphasized more, I'm happy to raise things at the GHC meetings. No guarantees that stuff will get prioritised but it might help avoid stuff falling through the cracks Do you know if anyone is looking into making cross work with Hadrian?
It would probably be far more effort than adding our own bindists to tarballs.nixos.org and is of limited benefit to x86 and aarch64, so I could understand if nobody wants to do it. | 15:54:29 |
Teo (he/him) | In reply to @alex:tunstall.xyz Do you know if anyone is looking into making cross work with Hadrian?
It would probably be far more effort than adding our own bindists to tarballs.nixos.org and is of limited benefit to x86 and aarch64, so I could understand if nobody wants to do it. Maybe this https://gitlab.haskell.org/ghc/ghc/-/merge_requests/11444 ? | 16:08:09 |
Teo (he/him) | In reply to @alex:tunstall.xyz Do you know if anyone is looking into making cross work with Hadrian?
It would probably be far more effort than adding our own bindists to tarballs.nixos.org and is of limited benefit to x86 and aarch64, so I could understand if nobody wants to do it. * Maybe this https://gitlab.haskell.org/ghc/ghc/-/merge_requests/11444 ? | 16:10:12 |
Teo (he/him) | In reply to @alex:tunstall.xyz Do you know if anyone is looking into making cross work with Hadrian?
It would probably be far more effort than adding our own bindists to tarballs.nixos.org and is of limited benefit to x86 and aarch64, so I could understand if nobody wants to do it. * Maybe this https://gitlab.haskell.org/ghc/ghc/-/merge_requests/11444 ?
Is there a specific set of issues you have in mind?
| 16:13:07 |
| @pkmean:matrix.org joined the room. | 17:05:13 |
| @pkmean:matrix.org left the room. | 17:15:15 |
| foxmean joined the room. | 17:24:22 |
Alex | In reply to @teoc:matrix.org
Maybe this https://gitlab.haskell.org/ghc/ghc/-/merge_requests/11444 ?
Is there a specific set of issues you have in mind?
That sounds like precisely it, yes.
Maybe if I get the time I'll try applying the MR in Nixpkgs... | 17:34:35 |
Teo (he/him) | There's also been a lot of work recently on making more boot libs easy to reinstall and on ghc-toolchain. Both of those should make everything cross related easier to implement in a nice way | 18:04:53 |
| 28 Jul 2025 |
Pierre Thierry | I'm trying to fix broken packages, starting with polysemy-zoo, I have the latest master from the nixpkgs repo, and the only files modified are broken.yaml and main.yaml in configuration-hackage2nix, but when I do:
./maintainers/scripts/haskell/regenerate-hackage-packages.sh
I get the following error:
hackage2nix: user error (Unexpected end-of-input, expecting JSON value)
Am I missing a step or doing something wrong?
| 13:53:54 |
chreekat | So you modified json and now you're getting a "user error: invalid json"? :D | 14:17:34 |
maralorn | Yeah, sounds like you made a syntax error in the yaml files. | 14:49:19 |
Pierre Thierry | Well, I didn't think my changes could be the source but I checked anyway: I get the error with a clean working directory. | 16:30:42 |