!RbXGJhHMsnQcNIDFWN:nixos.org

Haskell in Nixpkgs/NixOS

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

Load older messages


SenderMessageTime
15 Sep 2025
@alex:tunstall.xyzAlexNope, build time.13:55:29
@emilazy:matrix.orgemilybut that's not C13:55:39
@emilazy:matrix.orgemilyI mean it's Hugs outputting that right13:55:50
@emilazy:matrix.orgemilyso it's Hugs runtime13:55:55
@alex:tunstall.xyzAlex The NotReallyAType comes from base's autoconf script somehow not finding the corresponding Haskell type for a few C types. 13:56:31
@emilazy:matrix.orgemilyI see13:58:14
@emilazy:matrix.orgemilyprobably there are new warnings/errors in GCC confusing it13:58:32
@emilazy:matrix.orgemilythat happens a lot in autoconf13:58:41
@emilazy:matrix.orgemilycheck config.log13:58:43
@emilazy:matrix.orgemilyyou'll probably see some ancient looking C program that needs adapting13:58:56
@emilazy:matrix.orgemily you should of course autoreconfHook and get it on latest autotools 13:59:10
@alex:tunstall.xyzAlexThanks for the advice. I'll take a look when I get to work on the PRs.14:05:39
@bglgwyng:matrix.orgbglgwyngI realized that I diagnosed the issue wrong15:02:06
@bglgwyng:matrix.orgbglgwyng
{
        packages.zlib1 = (pkgs.haskellPackages.zlib).override { zlib = pkgs.zlib; };
        # it works
        packages.zlib2 = (pkgs.haskellPackages.callCabal2nix "zlib" inputs.zlib-src { }).override { zlib = pkgs.zlib; };
        # it works
        packages.splitmix1 = (pkgs.haskellPackages.splitmix).override { testu01 = null; };
        # it doesn't work
        packages.splitmix2 = (pkgs.haskellPackages.callCabal2nix "splitmix" inputs.splitmix-src { }).override { testu01 = null; };
      };

Only the last one failed with 'error: function 'anonymous lambda' called without required argument 'testu01''

15:02:33
@bglgwyng:matrix.orgbglgwyngHere is the reproducer https://github.com/bglgwyng/haskellPackages-override15:02:59
@bglgwyng:matrix.orgbglgwyng *
{
        packages.zlib1 = (pkgs.haskellPackages.zlib).override { zlib = pkgs.zlib; };
        # it works
        packages.zlib2 = (pkgs.haskellPackages.callCabal2nix "zlib" inputs.zlib-src { }).override { zlib = pkgs.zlib; };
        # it works
        packages.splitmix1 = (pkgs.haskellPackages.splitmix).override { testu01 = null; };
        # it doesn't work
        packages.splitmix2 = (pkgs.haskellPackages.callCabal2nix "splitmix" inputs.splitmix-src { }).override { testu01 = null; };
      };

Only the last one failed with error: function 'anonymous lambda' called without required argument 'testu01'

15:03:21
@bglgwyng:matrix.orgbglgwyng I can see testu01 in the arguments of cabal2nix-splitmix, but somehow the override failed. 15:04:08
@keypusher:matrix.orgkeypusherI have a hard time getting protoc (on the PATH) while building a package with callCabal2Nix. It's used by cabal extension.15:20:20
@keypusher:matrix.orgkeypusherAre there any tricks to troubleshooting that?15:21:06
@sternenseemann:systemli.orgsterni keypusher: cabal2nix does not really have the ability to do that automatically since Cabal does not allow specifying a dependency on a build tool that is not itself a Cabal package. You need to use addBuildTools or the like from haskell.lib.compose. 15:32:07
@sternenseemann:systemli.orgsterni bglgwyng: on what system does packages.splitmix2 fail to evaluate? 15:36:34
@keypusher:matrix.orgkeypusherOh ok. I tried googling "haskell.lib.compose addBuildtools" but came up a bit short. You don't happen to have some useful url?15:37:31
@keypusher:matrix.orgkeypusherthanks btw!15:37:53
@sternenseemann:systemli.orgsterni bglgwyng: the testu01 test suite is only buildable on linux, Cabal discards this dependency on non-linux, you can force the platform to use with e.g. --system x86_64-linux 15:38:40
@sternenseemann:systemli.orgsterni keypusher: https://nixos.org/manual/nixpkgs/stable/#haskell-trivial-helpers 15:39:11
@bglgwyng:matrix.orgbglgwyngit's x86_64-linux15:52:22
@bglgwyng:matrix.orgbglgwyngI haven't trie don the other platforms15:53:24
@sternenseemann:systemli.orgsterni

cabal2nix --system x86_64-linux https://hackage.haskell.org/package/splitmix-0.1.3.1.tar.gz gives me

{ mkDerivation, async, base, base-compat-batteries, bytestring
, containers, criterion, deepseq, fetchzip, HUnit, lib
, math-functions, process, random, template-haskell, test-framework
, test-framework-hunit, testu01, tf-random, vector
}:
mkDerivation {
  pname = "splitmix";
  version = "0.1.3.1";
  src = fetchzip {
    url = "https://hackage.haskell.org/package/splitmix-0.1.3.1.tar.gz";
    sha256 = "0mll5axdvh5wan6prh3v6l2n15xsj31ghi0g887ljpk515id5a2w";
  };
  libraryHaskellDepends = [ base deepseq ];
  testHaskellDepends = [
    async base base-compat-batteries bytestring containers deepseq
    HUnit math-functions process random template-haskell test-framework
    test-framework-hunit tf-random vector
  ];
  testSystemDepends = [ testu01 ];
  benchmarkHaskellDepends = [
    base containers criterion random tf-random
  ];
  description = "Fast Splittable PRNG";
  license = lib.licenses.bsd3;
}

So this looks fine.

15:54:59
@sternenseemann:systemli.orgsterniahh now I understand the issue.15:56:50
@sternenseemann:systemli.orgsterni

The problem with override is that it depends on initially computing the derivation successfully. This doesn't work if an argument is missing which is the case here with testu01. That's why callCabal2nix has a third argument to pass in arguments (which can also act as an override at the definition site). So you want to do:

(pkgs.haskellPackages.callCabal2nix "splitmix" (builtins.fetchTarball "https://hackage.haskell.org/package/splitmix-0.1.3.1.tar.gz") { testu01 = null /* just pass something */; }).override { testu01 = /* later we can pass something else: */ my-pkg; } 
15:59:14

Show newer messages


Back to Room ListRoom Version: 6