!RbXGJhHMsnQcNIDFWN:nixos.org

Haskell in Nixpkgs/NixOS

726 Members
For discussions and questions about Haskell with Nix, cabal2nix and haskellPackages in nixpkgs | Current Docs: https://haskell4nix.readthedocs.io/145 Servers

Load older messages


SenderMessageTime
18 Mar 2026
@woobilicious:matrix.orgwoobiliciousI have a questions about the general architecture of haskellPackages, does hackage have dep cycles? and how do you deal with them when generating the package list? I'm working on a little project that generates a package list from a foreign source, but it has cycles, and I'm kinda clueless on how to break cycles up without just removing all dependencies04:49:25
@alex:tunstall.xyzAlex Cross-compiling GHC 9.6+ shouldn't even eval, because of a throw sterni added after we found that Hadrian broke cross. Is there some difference between haskellPackages.ghc and haskell.compiler.ghc? 05:40:55
@alex:tunstall.xyzAlex

I have not seen anything that suggests that Cabal supports cycles, but you may want to try it out and see whether the dependency solver likes it.

But regardless of what Haskell is doing, I think you would be better off looking at how existing tools that work with the foreign source handle those cycles, since doing the same thing will give your tooling the best chance at doing no worse with weird scenarios you've yet to consider.

05:46:36
@alexfmpe:matrix.orgalexfmpeNot for native 05:46:36
@alexfmpe:matrix.orgalexfmpe
In reply to @alexfmpe:matrix.org
Not for native
One is cross compiler ghc, the other is cross compiled ghc
05:47:31
@alex:tunstall.xyzAlex Right, so haskellPackages.ghc is the same as buildPackages.ghc? 05:48:13
@alexfmpe:matrix.orgalexfmpe
In reply to @woobilicious:matrix.org
I have a questions about the general architecture of haskellPackages, does hackage have dep cycles? and how do you deal with them when generating the package list? I'm working on a little project that generates a package list from a foreign source, but it has cycles, and I'm kinda clueless on how to break cycles up without just removing all dependencies
You can have package cycles, just not component cycles. For packages A,B it's valid to have libA <- libB <- testA
05:50:04
@alexfmpe:matrix.orgalexfmpeIn cabal packages that is05:50:24
@alexfmpe:matrix.orgalexfmpehaskellPackages in particular is 'wrong' in that it generates one derivation per package, not per component05:50:54
@alexfmpe:matrix.orgalexfmpeSo we have to manually break cycles for a bunch of test packages with dontCheck05:51:15
@alexfmpe:matrix.orgalexfmpeSearch for 'cycle' or so in configuration-common.nix for examples05:51:40
@alexfmpe:matrix.orgalexfmpe`nix-build --show-trace` can help find specific cycles since it shows the call stack05:52:47
@alexfmpe:matrix.orgalexfmpe
In reply to @alex:tunstall.xyz
Right, so haskellPackages.ghc is the same as buildPackages.ghc?
I think so, though it seems completely backwards to me
05:53:21
@alexfmpe:matrix.orgalexfmpeI'd expect haskellPackages.foo to always have the same host platform05:53:46
@alexfmpe:matrix.orgalexfmpe* I'd expect pkgsCross.foo.haskellPackages.bar to always have 'foo' as same host platform for all 'bar'05:54:28
@alexfmpe:matrix.orgalexfmpeBut bar=ghc acts special05:54:53
@alexfmpe:matrix.orgalexfmpe
In reply to @alexfmpe:matrix.org
haskellPackages in particular is 'wrong' in that it generates one derivation per package, not per component
Or rather, cabal2nix is wrong, and haskellPackages is based on throwing cabal2nix at hackage
05:55:40
@alex:tunstall.xyzAlex I believe this is due to how ghc is threaded through haskellPackages. So that mkDerivation can find it, it is bound to ghc, but this only works well for native.
It also has weird consequences when you try using other compilers, where you can e.g. end up with haskellPackages.ghc being MicroHs.
06:08:19
@woobilicious:matrix.orgwoobiliciousAhh thanks for the feedback, I don't think manual intervention is practical here, the more I think about it, the more it might be easier to just build dirivation per package, with no "real" dependencies, and then de-duplicate strings some way to prevent infinite loops.07:45:37
@co0o0okies:matrix.orgcookies joined the room.11:01:33
@me:linj.techlinjJust found a new nix interpreter implemented from scratch in Haskell https://github.com/Novavero-AI/nova-nix. Any comments?11:05:00
@b:chreekat.netchreekatBig if true11:20:30
@alexfmpe:matrix.orgalexfmpeAuthor has been announcing it in couple rooms11:29:16
@alexfmpe:matrix.orgalexfmpeSeems like AI slop11:29:25
@alexfmpe:matrix.orgalexfmpe> Hand-rolled recursive descent parser for the full Nix expression language. 13 precedence levels, 18 AST constructors,11:29:30
@alexfmpe:matrix.orgalexfmpe"Now with 30% more precedence levels. Buy 3, take 4"11:30:37
@alexfmpe:matrix.orgalexfmpe* "Now with 30% more precedence levels. Buy 3, get 4"11:31:20
@magic_rb:matrix.redalder.orgmagic_rbIt is AI slop11:32:48
@magic_rb:matrix.redalder.orgmagic_rbIts fully slop-coded, top to bottom11:33:02
@woobilicious:matrix.orgwoobiliciousNothing screams "Haskell" coding like using a probalitistic LLM...11:33:04

Show newer messages


Back to Room ListRoom Version: 6