!RbXGJhHMsnQcNIDFWN:nixos.org

Haskell in Nixpkgs/NixOS

685 Members
For discussions and questions about Haskell with Nix, cabal2nix and haskellPackages in nixpkgs | Current Docs: https://nixos.org/manual/nixpkgs/unstable/#haskell | Current PR: https://github.com/nixos/nixpkgs/pulls?q=is%3Apr+is%3Aopen+head%3Ahaskell-updates | Maintainer Docs: https://github.com/NixOS/nixpkgs/blob/haskell-updates/pkgs/development/haskell-modules/HACKING.md | More Nix: #community:nixos.org | More Haskell: #haskell-space:matrix.org | Merger Schedule: https://cloud.maralorn.de/apps/calendar/p/H6migHmKX7xHoTFa/dayGridMonth/now | Join #haskell.nix:libera.chat for question about the alternative haskell.nix infrastructure134 Servers

Load older messages


SenderMessageTime
9 Dec 2025
@andromeda:tchncs.deandromedaoder?05:02:28
@andromeda:tchncs.deandromeda20251209_06h35m40s_grim.png
Download 20251209_06h35m40s_grim.png
05:35:58
@andromeda:tchncs.deandromedagoodness what is Cabal's problem /j05:36:10
@felineterrorist:matrix.orgterrorist :: Feline joined the room.06:47:19
@mangoiv.:matrix.orgMangoIV

No and it’s both a bad idea and it’s misguided.

  1. nixpkgs haskell support (and Haskell.nix) uses cabal anyway so you don’t get around it
  2. nobody except nix users will be able to build your package
  3. nix flakes are even worse on that sense
  4. please don’t upload things to hackage that people cannot build for that reason.

My tip is to use cabal as the source of truth.

08:42:50
@andromeda:tchncs.deandromedaso I'm thinking that I a) use ghcWithPackages to get libraries through Nix b) use cabal-install nix package for building and c) make build scripts .sh files or something so someone without nix will have no trouble building it. Does that sound workable?08:58:10
@maralorn:maralorn.demaralorn @andromeda:tchncs.de I don't understand what you are trying to achieve. Writing a Haskell package builder for nix is a major undertaking why not use one of the existing ones? 09:06:16
@maralorn:maralorn.demaralornAh, I was misunderstanding.09:07:31
@maralorn:maralorn.demaralornBut I am still unsure what you are trying to achieve.09:09:04
@andromeda:tchncs.deandromeda I want to be able to nix run .#debug to run my debug build, .#release for the release build, and .#docs to build Haddock into $out/docs. I currently have this implemented, but, as previously mentioned, people without Nix can't build it. By using Cabal as the actual build system and calling it from build scripts, I can use Nix as just a package manager which calls those same build scripts. Rather than using Nix as the package manager and build system like prior 09:12:56
@andromeda:tchncs.deandromedacan I see an example of like a well-done flake for a haskell package?09:13:43
@andromeda:tchncs.deandromedaso like MangoIV said I would be using Cabal as the 'source of truth' and Nix just as a convenience dev environment for those who have it.09:16:05
@maralorn:maralorn.demaralornAh, I see09:16:24
@andromeda:tchncs.deandromedaNix's flexibility is a blessing and a curse xD09:16:49
@maralorn:maralorn.demaralornMy best flake is probably this one others might have cleaner ones: https://github.com/maralorn/nix-output-monitor/blob/main/flake.nix09:19:33
@maralorn:maralorn.demaralornBut I am not saying that everything in there is recommended for every project09:20:20
@andromeda:tchncs.deandromedayo you write nom!? Awesome! I use it every day09:20:38
@maralorn:maralorn.demaralornAnyway the spirit of nixpkgs is generally to reuse language specific build instructions instead of dodging them.09:22:33
@maralorn:maralorn.demaralornThis is imo not a failure to separate concerns09:22:51
@maralorn:maralorn.demaralornnix does not know anything about Haskell or cabal09:23:14
@maralorn:maralorn.demaralornBut nixpkgs is a suite of libraries to build projects from all kinds of ecosystems. Using such a library to build a Haskell package seems smart to me instead of redundant.09:24:32
@andromeda:tchncs.deandromedaI love that despite there being a 'right' way to do Nix, it's such a powerful and general tool that you can go literal years doing it the 'wrong' way without a hitch09:27:29
@maralorn:maralorn.demaralornAlso your approach seems slightly dishonest because when you use ghcWithPackages you still rely on tons of packages being built with our Cabal based builder and e.g. it uses bespoke code to put a DB in your environment which cabal-install understands. So you are not really getting rid of the layer mangling you are complaining about.09:28:11
@maralorn:maralorn.demaralornThat being said no one is stoping you from doing it your way. 😆09:29:00
@maralorn:maralorn.demaralornI personally think that the redundancy of the usual approach is not a problem. Because all the redundant information can be auto-generated on the nix side by cabal2nix.09:32:14
@andromeda:tchncs.deandromeda this is where I am now, I'll shift it to a Cabal-centered approach after school. Lmk if you have any other cool tips! 09:35:32
@morj:morj.menMorj joined the room.10:44:13
@andromeda:tchncs.deandromedaI lied I'm going to mess around with FFI to see if I can get RGFW working instead of GLFW :)18:57:59
@andromeda:tchncs.deandromedaOk so it's not working. I've been trying to troubleshoot for a while... maybe it's the way I've linked dependent libraries? Maybe it's a type error in my FFI? A brief look-around by someone smarter than me would be greatly appreciated... one again ignore the atrocities that are the build process... https://git.mtgmonkey.net/Andromeda/hs-rgfw22:01:48
@andromeda:tchncs.deandromedathe problem is that a window doesn't appear and window_shouldClose is immediately false, leading me to believe a type representation error or a windowing dependency error has occuredd22:03:19

There are no newer messages yet.


Back to Room ListRoom Version: 6