!RbXGJhHMsnQcNIDFWN:nixos.org

Haskell in Nixpkgs/NixOS

717 Members
For discussions and questions about Haskell with Nix, cabal2nix and haskellPackages in nixpkgs | Current Docs: https://haskell4nix.readthedocs.io/ | More Nix: #community:nixos.org | More Haskell: #haskell-space:matrix.org143 Servers

Load older messages


SenderMessageTime
25 Sep 2025
@maralorn:maralorn.demaralornAh, nice.15:27:13
@maralorn:maralorn.demaralornThat’s less complicated than what I had in mind.15:27:28
@sternenseemann:systemli.orgsterni (he/him)I think the problem here is figuring out the right installed package identifier. I believe how this is computed is pretty much internal to Cabal 15:27:35
@maralorn:maralorn.demaralorn You can most certainly not know it a nix eval time. So you will probably need to do some finding through build inputs. 15:28:33
26 Sep 2025
@bglgwyng:matrix.orgbglgwyng Maybe I'm doing something hacky so I want to convince my self;
did the same thing happen when we tried to override a pakcage with the same version in haskell.packages and different transitive dependencies?
03:28:54
@bglgwyng:matrix.orgbglgwyngyes this worked03:41:00
@aspendowntime:matrix.org@aspendowntime:matrix.org removed their profile picture.05:46:41
@aspendowntime:matrix.org@aspendowntime:matrix.org removed their display name Eden (they/it/she).05:47:00
@aspendowntime:matrix.org@aspendowntime:matrix.org left the room.05:47:41
@bglgwyng:matrix.orgbglgwyng Where is pkgsHostTarget passed from?
https://github.com/NixOS/nixpkgs/blob/5364a5ff96df5c2e3b1048914f90fc39530087c2/pkgs/development/haskell-modules/generic-builder.nix#L641
09:28:48
@sternenseemann:systemli.orgsterni (he/him)pkgs/stdenv/generic/setup.sh09:51:35
@sternenseemann:systemli.orgsterni (he/him) yes this also happens in that case, hence you need to overrideScope 09:52:08
@maralorn:maralorn.demaralornA recent ghc version started embedding links to the ghc error index via terminal control codes.14:14:39
@maralorn:maralorn.demaralornThat doesn’t seem to work in nix logs.14:15:07
@maralorn:maralorn.demaralornDoes anyone know how that can be fixed?14:15:23
@maralorn:maralorn.demaralornIf not maybe we should deactivate/strip it?14:15:41
@maralorn:maralorn.demaralorn

Looks like that for me:

<no location info>: warning: [8;;https://errors.haskell.org/messages/GHC-42258GHC-422588;;] [-Wunused-packages]
14:16:36
@alex:tunstall.xyzAlex My guess is that [8;; is some kind of terminal escape code.
Although undesirable, does disabling colours work?
15:03:59
@teoc:matrix.orgTeo (he/him)A quick glance at the GHC codebase points me to GHC.Types.Errors where it seems like this is always emitted irrespective of whether you are in a fancy terminal. We probably shouldn't do that15:06:29
@teoc:matrix.orgTeo (he/him)Ah wait no it is a setting15:06:50
@teoc:matrix.orgTeo (he/him) yeah it determines if your terminal supports colours and only uses it in that case. And you can disable it with fprint-error-index-links=never 15:08:23
@maralorn:maralorn.demaralornYeah, but are we sure that nix can’t forward that? I mean it can forward colors.15:14:09
@b:chreekat.netchreekatSounds like something in the chain does not understand the encoding. Maybe something (nix?) is special cased for colors but not that17:04:37
@maralorn:maralorn.demaralornSounds likely.17:12:11
@maralorn:maralorn.demaralornMight be worth to open a nix issue about it.17:12:25
27 Sep 2025
@bglgwyng:matrix.orgbglgwyng

I figured it out after long debugging. I specified all the haskell dependencies using plan.json, so there should not be duplicated package instances.
However random is duplicated as you see in the log. It's because of operational package, which QuickCheck depends.
operational depends random in its executable component, not in its library component. So the generated plan.json doesn't include operational-to-random dependency.

However, cabal2nix of operational has random as its argument

{ mkDerivation, base, lib, mtl, random }:
mkDerivation {
  pname = "operational";
  version = "0.2.4.0";
  sha256 = "71581f7f89fce996079b19bf84ea473b47a3dab08fec9cc64266f3dff5e295c3";
  revision = "1";
  editedCabalFile = "1b5vjp87lh34lpp9i4mrwcmr6rs45r6azdamwinlhrxynn91n8ri";
  isLibrary = true;
  isExecutable = true;
  libraryHaskellDepends = [ base mtl ];
  executableHaskellDepends = [ base mtl random ];
  homepage = "http://wiki.haskell.org/Operational";
  description = "Implementation of difficult monads made easy with operational semantics";
  license = lib.licenses.bsd3;
  mainProgram = "operational-TicTacToe";
}
13:29:42
@bglgwyng:matrix.orgbglgwyng So random from haskellPackages is passed to this lambda and it is propagated to the packages depending on it 13:30:19
@bglgwyng:matrix.orgbglgwyng The result is that when hip is being built, the package db contains two random packages 13:30:49
@bglgwyng:matrix.orgbglgwyng Indeed, I applied setBuiltTargets to the packages, preventing the components not in plan.json from being built 13:32:00
@bglgwyng:matrix.orgbglgwyng However, setBuildTargets can't prevent the dependencies in executableHaskellDepends getting built and registered to package db not necessarily 13:32:47

Show newer messages


Back to Room ListRoom Version: 6