!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
26 Sep 2025
@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
@bglgwyng:matrix.orgbglgwyngHow can I fix this issue?13:33:16
@bglgwyng:matrix.orgbglgwyng It seems that Setup.hs configure doesn't provide options to specify components to build 13:34:06
@bglgwyng:matrix.orgbglgwyng.13:43:57
@maralorn:maralorn.demaralorn There should be an option to disable building of the executable and that should actually prevent the random dependency from executableHaskellDepends from being loaded into the package-db. (Rather certain that logic exists in the generic-builder.nix) If not or when you use another way to disable building of the executable you can do something like super.operational.override { random = null; }. 14:13:57
@bglgwyng:matrix.orgbglgwyng Yes. I found the workaround but I want to fix generic-builder to handle setBuildTarget properly. 14:33:31
@bglgwyng:matrix.orgbglgwynghttps://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/generic-builder.nix#L74314:46:41
@bglgwyng:matrix.orgbglgwyng I need a way to specify build targets in Setup.hs's configure phase to fix it 14:47:05
@bglgwyng:matrix.orgbglgwyngBut it doesn't support unfortunately14:47:56
@teoc:matrix.orgTeo (he/him)Haskell.nix seems to pass the name of the component to configure https://github.com/input-output-hk/haskell.nix/blob/751e1561c3fbc0a5cf136a689b70bbce567852a8/builder/comp-builder.nix#L23915:20:27
@alist:matrix.orgyliceee I'm getting
Error while expanding response file: /tmp/nix-shell.iCOh0S/ghci519500-0.rsp: openFile: does not exist (No such file or directory)
in the LSP mode stderr at random times in a haskell project using cabal/nix/direnv/emacs (with LSP mode and envrc mode)
21:22:43
@alist:matrix.orgyliceeeim unable to consistently replicate. has anyone else seen this?21:23:22
@alist:matrix.orgyliceee * I'm getting
Error while expanding response file: /tmp/nix-shell.iCOh0S/ghci519500-0.rsp: openFile: does not exist (No such file or directory)
in the LSP mode stderr at random times in a haskell project using cabal/nix/direnv/emacs (with envrc mode)
21:23:43
@alexfmpe:matrix.orgalexfmpeI've seen that a few times22:54:40
@alexfmpe:matrix.orgalexfmpeI ended up disabling direnv as it's been too unreliable for me22:56:12
@alexfmpe:matrix.orgalexfmpeAlso kept getting into stale states forcing me to rm .direnv after a lot of "how is this possible"22:57:08
28 Sep 2025
@lavalier:matrix.orglibman joined the room.05:35:06
@sternenseemann:systemli.orgsterni (he/him) bglgwyng: as far as I know, there is no way to specify the build targets at configure time 10:28:22
@sternenseemann:systemli.orgsterni (he/him)The package database is prepared by us and includes all dependencies Cabal reports to us when generating the expression. Not sure if you could influence this to trim down to specific targets, in any case cabal2nix does not support this at the moment.10:29:38
@sternenseemann:systemli.orgsterni (he/him)interesting that doesn't seem to be documented?10:31:01
@sternenseemann:systemli.orgsterni (he/him) it would be nice if we could set testTargets and buildTargets at configure time already 10:31:28
@bglgwyng:matrix.orgbglgwyngIndeed I tried the same thing but it didn't work11:46:44

Show newer messages


Back to Room ListRoom Version: 6