!RbXGJhHMsnQcNIDFWN:nixos.org

Haskell in Nixpkgs/NixOS

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

Load older messages


SenderMessageTime
21 Jul 2025
@magic_rb:matrix.redalder.orgmagic_rb but not in cabal.project 10:08:29
@magic_rb:matrix.redalder.orgmagic_rband when i was profiling this back then, most of the slowness was in my code because of my custom monad transformer10:09:04
@magic_rb:matrix.redalder.orgmagic_rb im gonna remove the inline pragmas, those didnt seem to be enough last time i tried, which is why i enabled -fexpose-all-unfoldings 10:10:29
@magic_rb:matrix.redalder.orgmagic_rbbut ill try to removing them again and see if some difference shows up10:10:42
@magic_rb:matrix.redalder.orgmagic_rbokay, same result, im completely confused and have no clue what is going on10:19:40
@maralorn:maralorn.demaralornI mean, is it a different ghc version than when you added those flags?10:20:28
@magic_rb:matrix.redalder.orgmagic_rbi think i found it10:21:36
@magic_rb:matrix.redalder.orgmagic_rbthere was a problem between the keyboard and my chair10:21:50
@magic_rb:matrix.redalder.orgmagic_rbthe monkey forgot to use a variable he declared10:21:57
@alex:tunstall.xyzAlex
In reply to @magic_rb:matrix.redalder.org
im benchmarking a thing i wrote and im making a nix package out of a cabal file using cabal2nix, however if i change the source cabal file and remove -fllvm, -O2, or -fexpose-all-unfoldings the performance measurements dont seem to change even though im positive they should. Is nixpkgs overwriting my flags somehow?
If you're using a profiling build, beware of automatic cost centres (IIRC enabled by default in cabal).
10:37:54
@magic_rb:matrix.redalder.orgmagic_rb
In reply to @alex:tunstall.xyz
If you're using a profiling build, beware of automatic cost centres (IIRC enabled by default in cabal).
Nope, i know about those
10:49:29
22 Jul 2025
@maralorn:maralorn.demaralornDoes anyone here grok/has used the useIntermediates stuff? I have one question: Can it reuse the intermediates of a previous build even when that build had other dependency hashes on the nix side? The argument was that cabal-install does not always have to recompile your project when you modify your nix shell. And the reusing is probably happening based on some cabal level hashing?15:02:25
@sternenseemann:systemli.orgsterniWell development shell is out anyways since that's Setup.hs which cabal-install won't be able to reuse in any shape or form I think18:57:16
@maralorn:maralorn.demaralornAre you sure? Maybe the components are similar enough? I mean they have been compiled with the same ghc. Isn’t it basically a dir with .hie and object files in both cases?20:55:26
24 Jul 2025
@keetonbrewster:matrix.orgKeeton Brewster joined the room.00:12:02
@keetonbrewster:matrix.orgKeeton BrewsterHi everyone, is there a Haskell specific Nix beginner guide out there? 00:14:32
@keypusher:matrix.orgkeypusherI think it's a bit fragmented depending on your needs / approach as can be seen in this thread https://www.reddit.com/r/haskell/comments/1cqfboq/latest_guidance_on_using_haskell_with_nix/ . Some years ago my searches often ended up here https://haskell4nix.readthedocs.io/ 00:45:35
@keypusher:matrix.orgkeypusherI would suggest you start wo using these evolved approaches and try to have as few layers on top of "vanilla"/"flakes" nix01:09:48
@keetonbrewster:matrix.orgKeeton BrewsterThank you!01:51:31
@keetonbrewster:matrix.orgKeeton BrewsterThere seems to be a thousand ways to do it which is confusing for a newbie01:56:06
@bglgwyng:matrix.orgbglgwyng joined the room.05:41:12
@bglgwyng:matrix.orgbglgwyng Hello! I'm trying to build a nixpkgs.haskellPackages from an arbitrary stackage snapshot. I just found regenerate-hackage-packages.sh in nixpkgs and also hackage2nix in cabal2nix. Is hackage2nix enough for my purpose? I don't fully understand how two tools differ. 05:54:08
@maralorn:maralorn.demaralorn @keetonbrewster:matrix.org haskell4nix.readthedocs.io is outdated. It's uptodate version is the nixpkgs manual Haskell section. 06:07:02
@maralorn:maralorn.demaralorn
In reply to @bglgwyng:matrix.org
Hello! I'm trying to build a nixpkgs.haskellPackages from an arbitrary stackage snapshot. I just found regenerate-hackage-packages.sh in nixpkgs and also hackage2nix in cabal2nix. Is hackage2nix enough for my purpose? I don't fully understand how two tools differ.
Huh, I don't think we expect downstream users of hackage2nix. I fear that you won't get very far. But if you really want do this the easiest way would probably be to look at the update stackage script in nixpkgs modify it to not use the newest but your desired snapshot, run it and then run the regenerate script. You can think of the regenerate script as running hackage2nix with all correct configuration for nixpkgs in place. Running hackage2nix without it would probably require duplicating parts of it.
06:15:22
@bglgwyng:matrix.orgbglgwyng What if I want to avoid making my own version of nixpkgs? I prefer more local apporach such as generating .nix file that can be used to replace nixpkgs.haskellPackage. Can I do the same thing using 'regenerate-hackage-packages'? 06:45:03
@maralorn:maralorn.demaralornIt's not meant to be used that way, no. But maybe you can take it as an inspiration. Maybe you want to have a look at stacklock2nix it might be closer to your needs.06:47:25
@bglgwyng:matrix.orgbglgwyngDo you mean https://github.com/cdepillabout/stacklock2nix this repo?06:59:05
@maralorn:maralorn.demaralorn
In reply to @keetonbrewster:matrix.org
Hi everyone, is there a Haskell specific Nix beginner guide out there?
That reminds me. I actually did a talk about that at zurihac. It might be helpful: https://m.youtube.com/watch?v=xOjKAatxD_g&list=PLOvRW_utVPVlFEXuyaIVILO1t_48e4Ai2&index=9&pp=iAQB
06:59:34
@bglgwyng:matrix.orgbglgwyngIndeed, I tried an approach using 'plan.json', cabal dry run generates plan.json and nix fetches the source code, however it caused too frequent rebuild of existing library. So I'm looking for a way to pre-bake package set.07:01:47
@maralorn:maralorn.demaralorn
In reply to @maralorn:maralorn.de
That reminds me. I actually did a talk about that at zurihac. It might be helpful: https://m.youtube.com/watch?v=xOjKAatxD_g&list=PLOvRW_utVPVlFEXuyaIVILO1t_48e4Ai2&index=9&pp=iAQB
It's sadly not super structured or dense, but I actually think we covered a lot of useful information.
07:04:59

Show newer messages


Back to Room ListRoom Version: 6