!RbXGJhHMsnQcNIDFWN:nixos.org

Haskell in Nixpkgs/NixOS

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

Load older messages


SenderMessageTime
15 Sep 2025
@sternenseemann:systemli.orgsterni (he/him) 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 (he/him) 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 (he/him)

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.orgsterni (he/him)ahh now I understand the issue.15:56:50
@sternenseemann:systemli.orgsterni (he/him)

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
@bglgwyng:matrix.orgbglgwyngAh I see16:06:43
@bglgwyng:matrix.orgbglgwyngThanks!16:06:46
@bglgwyng:matrix.orgbglgwyng One thing annoying is that I can investigate the argments with builtins.functionArgs (pkgs.callCabal2nix name src) 16:13:54
@bglgwyng:matrix.orgbglgwyngMaybe it's because wrapped? I think I can find how to fix it16:14:12
@keypusher:matrix.orgkeypusherSo going the addBuildTools route will require me to build wo using callCabal2Nix then?16:19:31
@maralorn:maralorn.demaralornI am missing a bit of context, but I don’t think so. Both functions are compatible. First call callCabal2Nix then apply addBuildTools to the result of the function.16:33:23
@keypusher:matrix.orgkeypusherOh ok. I'll try that16:34:22
@keypusher:matrix.orgkeypusherYou made my day. 4 hours of struggling just came to an end. My nix intuition is lacking.16:36:43
@keypusher:matrix.orgkeypusherThanks 🎉16:37:15
@sternenseemann:systemli.orgsterni (he/him) I noticed that, too, yesterday, I think this is a bug and is probably fixable 17:43:17
@alex:tunstall.xyzAlex
In reply to @sternenseemann:systemli.org
I would just start with adding a MicroHs package set built with GHC as we don't have hugs and then just iterate on that; maybe add hugs separately, have a hugs package set (if that even makes sense).
Not sure which branch to PR to.
I assume haskell-updates is the best choice?
(Hugs fix without GCC 13 is ready.)
22:37:00
@sternenseemann:systemli.orgsterni (he/him)can also be master if you don’t depend on anything in h-u22:47:03
@alex:tunstall.xyzAlexEven for the mhs package set?22:48:00
@alex:tunstall.xyzAlex
In reply to @sternenseemann:systemli.org
can also be master if you don’t depend on anything in h-u
Hugs fix: https://github.com/NixOS/nixpkgs/pull/443281
22:53:44
@sternenseemann:systemli.orgsterni (he/him)the mhs package set is probably better on h-u since we’d want to figure out CI22:58:06
@sternenseemann:systemli.orgsterni (he/him)I’ll just see to it that hugs gets propagated quickly to the branch after megre22:58:29
@alex:tunstall.xyzAlexOk, thanks.22:58:50
16 Sep 2025
@bglgwyng:matrix.orgbglgwyng Do you mean a bug in builtins.functionArgs? 00:08:45
@bglgwyng:matrix.orgbglgwynghttps://github.com/bglgwyng/nix-x-cabal I wrote another Nix + Haskell framework. It is based on flake-parts and uses plan.json to reproducible builds. It delegates all the network access from Cabal to Nix, and runs cabal build in pure way.04:59:21
@bglgwyng:matrix.orgbglgwyng It doesn't use pre-baked package set, but resolves version constraints. So you can freely choose any version of ghc(at this moment, in nixpgks.haskell.packages.ghc***) 05:00:45
@bglgwyng:matrix.orgbglgwyngI wish I could provide the docs right now, but nix-options-doc and flake-parts don't play well together for some reasons..05:10:06
@alex:tunstall.xyzAlex
In reply to @bglgwyng:matrix.org
https://github.com/bglgwyng/nix-x-cabal

I wrote another Nix + Haskell framework. It is based on flake-parts and uses plan.json to reproducible builds. It delegates all the network access from Cabal to Nix, and runs cabal build in pure way.

Do you have a typo here?

https://github.com/bglgwyng/nix-x-cabal/blob/4c7136218ba15da9304a054fbaeb8641db5592c3/lib/make-noindex-repository.nix#L4

(Was looking through wondering whether you're using IFD.)

07:17:46
@bglgwyng:matrix.orgbglgwyngThanks! 07:19:13

Show newer messages


Back to Room ListRoom Version: 6