!RbXGJhHMsnQcNIDFWN:nixos.org

Haskell in Nixpkgs/NixOS

744 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.org148 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
15 Sep 2025
@bglgwyng:matrix.orgbglgwyng * From my understanding, when we use nixpkgs's haskellPackages, we usually deal with the result of callPackage cabal2nix-lambda rather than cabal2nix-lambda itself? 03:56:00
@bglgwyng:matrix.orgbglgwyng
{
  "zlib" = callPackage
    ({ mkDerivation, base, bytestring, QuickCheck, tasty
     , tasty-quickcheck, zlib
     }:
     mkDerivation {
       pname = "zlib";
       version = "0.6.3.0";
       sha256 = "1nh4xsm3kgsg76jmkcphvy7hhslg9hx1s75mpsskhi2ksjd9ialy";
       revision = "5";
       editedCabalFile = "0mj3f7ql54p0pfa5a6q4xv4ci8xf00616ls0nyadpmlqbb4qilwn";
       libraryHaskellDepends = [ base bytestring ];
       librarySystemDepends = [ zlib ];
       testHaskellDepends = [
         base bytestring QuickCheck tasty tasty-quickcheck
       ];
       description = "Compression and decompression in the gzip and zlib formats";
       license = lib.licenses.bsd3;
     }) {inherit (pkgs) zlib;};
}

this is from hackage-pacakges.nix, and I'm not sure if I have any chance to override zlib when callPackage is already called.

03:57:11
@alex:tunstall.xyzAlex

So you want to be able to e.g. add extra arguments to the cabal2nix command?

IIRC that's possible with callCabal2nix and obviously if you implement the command yourself. Overriding is trickier but should still be possible through overriding callCabal2nix (this isn't pretty).

I'm having trouble understanding why overriding the result is insufficient in your case.

04:02:48
@bglgwyng:matrix.orgbglgwyng Hmm, I tried such a thing splitmix = super.splitmix.override { testu01 = null; }; but it didn't work. 04:06:32
@bglgwyng:matrix.orgbglgwyng

splitmix's definition is like

"splitmix" = callPackage
    ({ mkDerivation, async, base, ..., testu-01 }:
     mkDerivation {
04:07:13
@bglgwyng:matrix.orgbglgwyng To provide the context, I'm not using the vanilla haskellPackages, but the generated one for my purpose. 04:08:38
@bglgwyng:matrix.orgbglgwyng I was trying to handle "error: function 'anonymous lambda' called without required argument 'testu01'" this error message, by passing testu01 = null just like hackage-packages.nix does. 04:09:24
@bglgwyng:matrix.orgbglgwyng Of course I can do it with the cabal2nix expression, but I was wondering if I can do the same thing when callPackage is already applied. 04:10:09
@bglgwyng:matrix.orgbglgwyng If any approach simliar to splitmix = super.splitmix.override { testu01 = null; } is possible, it would be really helpful. 04:10:53
@bglgwyng:matrix.orgbglgwyngah maybe I made a stupid mistake04:16:01
@bglgwyng:matrix.orgbglgwyng it seems that the result of callCabal2Nix is not overridable, and I should wrap it manullay to make it overridable. 04:16:42
@bglgwyng:matrix.orgbglgwyng Yes, the vanilla pkgs.haskellPackages.* things are overridable and my callCabal2Nix results are not overridable. And I just found that make-package-set applies makeOverridable manullay. 04:19:02

Show newer messages


Back to Room ListRoom Version: 6