!RbXGJhHMsnQcNIDFWN:nixos.org

Haskell in Nixpkgs/NixOS

661 Members
For discussions and questions about Haskell with Nix, cabal2nix and haskellPackages in nixpkgs | Current Docs: https://nixos.org/manual/nixpkgs/unstable/#haskell | Current PR: https://github.com/nixos/nixpkgs/pulls?q=is%3Apr+is%3Aopen+head%3Ahaskell-updates | Maintainer Docs: https://github.com/NixOS/nixpkgs/blob/haskell-updates/pkgs/development/haskell-modules/HACKING.md | More Nix: #community:nixos.org | More Haskell: #haskell-space:matrix.org | Merger Schedule: https://cloud.maralorn.de/apps/calendar/p/H6migHmKX7xHoTFa/dayGridMonth/now | Join #haskell.nix:libera.chat for question about the alternative haskell.nix infrastructure132 Servers

Load older messages


SenderMessageTime
23 Jun 2025
@maralorn:maralorn.demaralorn(I guess you know that, but that is probably the problem you remember.)20:25:22
@alex:tunstall.xyzAlex Given that GHC 9.10 is being used, cabal update may be easier than jailbreaking and patching various packages.
I haven't tried upgrading beyond the default GHC lately, but when I do it has always involved Nix overrides...
20:28:34
@maralorn:maralorn.demaralornI mean for building unix there shouldn’t be any problems either way, tbh.20:36:37
@maralorn:maralorn.demaralornI assume only problem is that test dependencies of boot packages are not boot packages themselves.20:37:10
@alex:tunstall.xyzAlex True, but it's rare for a project to only need boot libraries.
It's hard to say what the easiest approach is without a better understanding of Artem's use case.
20:38:49
@artem.types:matrix.orgArtem
In reply to @maralorn:maralorn.de
@artem.types:matrix.org 1. Did you run cabal update? 2. Try reseting by removing dist-newstyle.
I tried these, yes. I've been having this issue a while, so I've tried many simple things like that
20:54:04
@maralorn:maralorn.demaralorn Artem: I see. If you would like more help then maybe you can share the Haskell relevant part of the nix configuration (e.g. the nix- shell or your system config) which installed ghc, etc and also the full log of the failing command? 20:58:38
@artem.types:matrix.orgArtem @maralorn:maralorn.de: thank you, I'll do that tonight. 21:06:52
24 Jun 2025
@artem.types:matrix.orgArtem

here's one way it fails for me (other version of GHC because it's another project that's easier to set up). I'm trying to build cabal from source, and I'm using very basic nix shell to get simple things like zlib into scope.

❯ git clone git@github.com:haskell/cabal
...
❯ git clone git@github.com:ulysses4ever/cabal.nix
...
❯ cd cabal
❯ nix develop ../cabal.nix
$ cabal build cabal
Build profile: -w ghc-9.6.6 -O1
In order, the following will be built (use -v for more details):
... long list...
Downloading  unix-2.8.7.0
Starting     base64-bytestring-1.2.1.0 (lib)
Starting     cryptohash-sha256-0.11.102.1 (lib)
Starting     regex-base-0.94.0.3 (lib)
Starting     os-string-2.0.7 (lib)
Starting     safe-exceptions-0.1.7.4 (lib)
Starting     th-compat-0.1.6 (lib)
Starting     splitmix-0.1.1 (lib)
Starting     atomic-counter-0.1.2.3 (lib)
Starting     base16-bytestring-1.0.2.0 (lib)
Starting     ed25519-0.0.5.0 (lib)
Downloaded   unix-2.8.7.0
Downloading  process-1.6.26.1
Starting     unix-2.8.7.0 (all, legacy fallback: build-type is Configure)
Downloaded   process-1.6.26.1
Downloading  semaphore-compat-1.0.0
Building     base64-bytestring-1.2.1.0 (lib)
Building     cryptohash-sha256-0.11.102.1 (lib)
Building     regex-base-0.94.0.3 (lib)
Building     os-string-2.0.7 (lib)
Building     safe-exceptions-0.1.7.4 (lib)
Building     splitmix-0.1.1 (lib)
Building     th-compat-0.1.6 (lib)
Downloaded   semaphore-compat-1.0.0
Building     base16-bytestring-1.0.2.0 (lib)
Building     atomic-counter-0.1.2.3 (lib)
Building     ed25519-0.0.5.0 (lib)
Installing   th-compat-0.1.6 (lib)
Installing   atomic-counter-0.1.2.3 (lib)
Installing   base16-bytestring-1.0.2.0 (lib)
Completed    th-compat-0.1.6 (lib)
Completed    base16-bytestring-1.0.2.0 (lib)
Installing   safe-exceptions-0.1.7.4 (lib)
Completed    atomic-counter-0.1.2.3 (lib)
Installing   base64-bytestring-1.2.1.0 (lib)
Installing   splitmix-0.1.1 (lib)
Completed    safe-exceptions-0.1.7.4 (lib)
Installing   regex-base-0.94.0.3 (lib)
Installing   cryptohash-sha256-0.11.102.1 (lib)
Completed    base64-bytestring-1.2.1.0 (lib)
Completed    splitmix-0.1.1 (lib)
Completed    regex-base-0.94.0.3 (lib)
Completed    cryptohash-sha256-0.11.102.1 (lib)
Installing   ed25519-0.0.5.0 (lib)
Completed    ed25519-0.0.5.0 (lib)
Installing   os-string-2.0.7 (lib)
Completed    os-string-2.0.7 (lib)

Failed to build unix-2.8.7.0. The failure occurred during the configure step.
Build log (
/home/artem/.cache/cabal/logs/ghc-9.6.6/unix-2.8.7.0-f12ffa080428729a9cad2c9d340f8a2e41259c127db9b0b6e0d00096ef0bef24.log
):
Configuring unix-2.8.7.0...
Error: [Cabal-8010]
Encountered missing or private dependencies:
    tasty, tasty-hunit, tasty-quickcheck

Error: [Cabal-7125]
Failed to build unix-2.8.7.0 (which is required by exe:cabal from cabal-install-3.15.0.0). See the build log above for details.

Build log isn't very useful:

❯ cat /home/artem/.cache/cabal/logs/ghc-9.6.6/unix-2.8.7.0-f12ffa080428729a9cad2c9d340f8a2e41259c127db9b0b6e0d00096ef0bef24.log

Configuring unix-2.8.7.0...
Error: [Cabal-8010]
Encountered missing or private dependencies:
    tasty, tasty-hunit, tasty-quickcheck
03:30:29
@maralorn:maralorn.demaralornHuh, wild06:49:28
@maralorn:maralorn.demaralornI mean that is a test dependency. Does cabal-install by default build the test suites of dependencies?07:03:23
@maralorn:maralorn.demaralornI had a look at the .cabal file and it looks normalish.07:04:26
@b:chreekat.netchreekat I wonder if nixos is a red herring. @artem.types:matrix.org you don't have any stray GHC environment files or cabal project files around, do you? 08:01:10
@magic_rb:matrix.redalder.orgmagic_rb how can i create a haskellPackages set with a patched GHC? 13:33:43
@magic_rb:matrix.redalder.orgmagic_rb

in a devshell i get the ghc i want with:

      (ghc.overrideAttrs (old: {
        patches = old.patches or [ ] ++ [ ./dont-free-stable-ptr.patch ];
      })).override
      { useLLVM = true; }
13:34:04
@magic_rb:matrix.redalder.orgmagic_rb but im not sure how to make haskellPackages use that 13:34:20
@magic_rb:matrix.redalder.orgmagic_rboh maybe i found it13:37:01
@magic_rb:matrix.redalder.orgmagic_rb

nope, i still dont know how to do it, i tried

          haskellPackages = pkgs.haskellPackages.override {
            ghc = modifyGhc pkgs.haskellPackages.ghc;
          };

modifyGhc applies the modifications i sent above

13:56:59
@artem.types:matrix.orgArtem chreekat: man, you made my day: it looks like the default GHC environment screwed things up 13:59:17
@b:chreekat.netchreekatLol I knew it14:15:38
@maralorn:maralorn.demaralorn
In reply to @magic_rb:matrix.redalder.org
how can i create a haskellPackages set with a patched GHC?
You can browse through nixpkgs around haskell-modules/make-package-set.nix and look at the function arguments you can override.
14:28:11
@magic_rb:matrix.redalder.orgmagic_rb
In reply to @maralorn:maralorn.de
You can browse through nixpkgs around haskell-modules/make-package-set.nix and look at the function arguments you can override.
Yeah i got somewhere i think, i wont declare success till it compiles and works
14:32:25
@ners:nixos.devnershttps://github.com/ners/nix-wasm/blob/main/flake.nix As a working example, here I create a Haskell package set with the WASM GHC (and recreate the entire stdenv while I'm at it).14:45:32
@maralorn:maralorn.demaralornIt is much more complicated than what you are trying to do though, since it is cross-compiling.15:53:30
@magic_rb:matrix.redalder.orgmagic_rbYeah for me it was quite simple, just took ages to compile :D15:59:11
@lenny:flipdot.orgLenny. changed their display name from Lenny. [9731 DECT] to Lenny..20:25:08
@le:4d2.orglevin

I'm a complete newbie to nix, so please excuse my lack of knowledge:

I'm trying to build the broken package haskore, which is auto-generated by hackage2nix. When building with NIXPKGS\_ALLOW\_BROKEN=1, the build fails with a dependency error (which looks like it comes from cabal, even tough I'm building with nix?):

CallStack (from HasCallStack):
  withMetadata, called at libraries/Cabal/Cabal/src/Distribution/Simple/Utils.hs:368:14 in Cabal-3.10.3.0-cb0e:Distribution.Simple.Utils
Error: Setup: Encountered missing or private dependencies:
bytestring >=0.9 && <0.11, transformers >=0.0.1 && <0.6

Now, further 'investigation' showed, that the packages bytestringand transformersare not in nixpkgs, because the modules they provide are automatically installed when installing ghc.

When trying to tell nix to just not care about those dependencies, I looked into the auto-generated hackage-packages.nix and, indeed, the dependencies for bytestring and transformers are in the buildInputs. But the confusing part is, that many packages have those dependencies, but build perfectly fine, even tough their dependencies, as it seems to me, can't be fulfilled.

Even tough I didn't test it (because I didn't understand how), I believe the error persists in the haskell-updates branch, since the package definition of haskore didn't change.

Can someone explain this to me? Does testHaskellDepends have anything to do with the problem? And do I, with just enough understanding of nix to successfully build my NixOS System, have a chance to fix this issue locally or upstream in about 1-2 days of work? Might someone even volunteer to help me with this?

20:52:39
@le:4d2.orglevin *

I'm a complete newbie to nix, so please excuse my lack of knowledge:

I'm trying to build the broken package haskore, which is auto-generated by hackage2nix. When building with NIXPKGS\_ALLOW\_BROKEN=1, the build fails with a dependency error (which looks like it comes from cabal, even tough I'm building with nix?):

CallStack (from HasCallStack):
  withMetadata, called at libraries/Cabal/Cabal/src/Distribution/Simple/Utils.hs:368:14 in Cabal-3.10.3.0-cb0e:Distribution.Simple.Utils
Error: Setup: Encountered missing or private dependencies:
bytestring >=0.9 && <0.11, transformers >=0.0.1 && <0.6

Now, further 'investigation' showed, that the packages bytestring and transformers are not in nixpkgs, because the modules they provide are automatically installed when installing ghc.

When trying to tell nix to just not care about those dependencies, I looked into the auto-generated hackage-packages.nix and, indeed, the dependencies for bytestring and transformers are in the buildInputs. But the confusing part is, that many packages have those dependencies, but build perfectly fine, even tough their dependencies, as it seems to me, can't be fulfilled.

Even tough I didn't test it (because I didn't understand how), I believe the error persists in the haskell-updates branch, since the package definition of haskore didn't change.

Can someone explain this to me? Does testHaskellDepends have anything to do with the problem? And do I, with just enough understanding of nix to successfully build my NixOS System, have a chance to fix this issue locally or upstream in about 1-2 days of work? Might someone even volunteer to help me with this?

20:54:33
@emilazy:matrix.orgemilyare you sure the issue isn't that they require too old a version for the GHC?20:56:54
@maralorn:maralorn.demaralorn
In reply to @le:4d2.org

I'm a complete newbie to nix, so please excuse my lack of knowledge:

I'm trying to build the broken package haskore, which is auto-generated by hackage2nix. When building with NIXPKGS\_ALLOW\_BROKEN=1, the build fails with a dependency error (which looks like it comes from cabal, even tough I'm building with nix?):

CallStack (from HasCallStack):
  withMetadata, called at libraries/Cabal/Cabal/src/Distribution/Simple/Utils.hs:368:14 in Cabal-3.10.3.0-cb0e:Distribution.Simple.Utils
Error: Setup: Encountered missing or private dependencies:
bytestring >=0.9 && <0.11, transformers >=0.0.1 && <0.6

Now, further 'investigation' showed, that the packages bytestringand transformersare not in nixpkgs, because the modules they provide are automatically installed when installing ghc.

When trying to tell nix to just not care about those dependencies, I looked into the auto-generated hackage-packages.nix and, indeed, the dependencies for bytestring and transformers are in the buildInputs. But the confusing part is, that many packages have those dependencies, but build perfectly fine, even tough their dependencies, as it seems to me, can't be fulfilled.

Even tough I didn't test it (because I didn't understand how), I believe the error persists in the haskell-updates branch, since the package definition of haskore didn't change.

Can someone explain this to me? Does testHaskellDepends have anything to do with the problem? And do I, with just enough understanding of nix to successfully build my NixOS System, have a chance to fix this issue locally or upstream in about 1-2 days of work? Might someone even volunteer to help me with this?

Excellent analysis. The problem is most cetrainly what emily says. haskore is not satisfied with the bytestring version we provide. You see the error from cabal because the nixpkgs Haskell builder uses the Cabal library. You can hopefully easily fix it by applying the doJailbreak helper to the haskore package. You can read about it in the nixpkgs manual. A grep through nixpkgs will give you plenty of usage examples.
21:03:01

Show newer messages


Back to Room ListRoom Version: 6