Haskell in Nixpkgs/NixOS | 711 Members | |
| For discussions and questions about Haskell with Nix, cabal2nix and haskellPackages in nixpkgs | Current Docs: https://haskell4nix.readthedocs.io/ | 143 Servers |
| Sender | Message | Time |
|---|---|---|
| 25 Jul 2025 | ||
| 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. | 23:24:27 | |
| But of course the error might be somewhere else. This has all so many moving parts and I am trying to learn the concepts. | 23:25:19 | |
| 26 Jul 2025 | ||
buildPackages is pkgsBuildBuild | 01:56:32 | |
packages that run on buildPlatform and target (when they are compilers) buildPlatform | 01:56:44 | |
so buildPackages.ghc should not compile for WASM | 01:56:55 | |
| there are some weirdnesses here though because some packages are "a level up" | 01:57:07 | |
e.g. stdenv is odd | 01:57:24 | |
* e.g. stdenv.cc is odd | 01:57:36 | |
| agh! | 01:58:12 | |
ok never mind I totally got my package sets mixed up. buildPackages is pkgsBuildHost :) | 01:58:22 | |
pkgsBuildBuild is used to build things for the build platform, pkgsBuildHost for the host platform | 01:58:39 | |
("target platform" is only relevant from the perspective of a compiler. you should usually be talking about "build platform" and "host platform". from the perspective of pkgsFooBar.someCompiler, the consumer's Foo platform is the compiler's buildPlatform and hostPlatform, and the consumer's Bar platform is the compiler's targetPlatform. e.g. if you use pkgsBuildHost โ buildPackages โ in a package, and select a compiler from it, that compiler will have compiler's buildPlatform = your buildPlatform, compiler's hostPlatform = your buildPlatform, compiler's targetPlatform = your hostPlatform) | 02:00:15 | |
| wellโฆ hopefully all that made things more confusing | 02:00:28 | |
| 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 | |
| so where does a cross compiler fit into that? (How do you specify Target?) | 04:34:15 | |
And then when I have a fix, do I create a PR to marge into haskell-updates? | 04:49:29 | |
In reply to @aidalgol:matrix.orgYes | 07:27:06 | |
| Leaving out the confusing mess that is splicing, cross starts by setting So with WASM, | 07:40:16 | |
In reply to @maralorn:maralorn.de
The | 08:00:57 | |
| 08:27:13 | ||
| Interesting article on cross compilation in nixpkgs if you haven't seen it https://blog.obsidian.systems/compiler-bootstrapping-in-nixpkgs/ | 08:54:04 | |
In reply to @b:chreekat.netNot cross compiling ghc though ๐ | 14:04:30 | |
| ...yet | 14:15:37 | |
| maralorn: fyi https://github.com/NixOS/nixpkgs/pull/424162/commits/3ddc9cb90a53f999a1b0c3b4b7a6215973fa6df0 | 20:23:57 | |
| we should cross compile some bindists before it stops being possible :p | 20:25:18 | |
| True, maybe time to try asking around again. | 21:34:49 | |
| 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 | |
| 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 | ||
In reply to @sternenseemann:systemli.orgBtw 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 | |
In reply to @teoc:matrix.orgDo 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 | |