!RbXGJhHMsnQcNIDFWN:nixos.org

Haskell in Nixpkgs/NixOS

681 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
29 Nov 2025
@alex:tunstall.xyzAlex
In reply to @sellout:matrix.org
I’m having an issue with using a cabal-version other than the one included with GHC. There is a Cabal bug that was fixed in 3.10.3. I updated my Cabal files to include cabal-version: 3.10.3, but my packages support back to GHC 9.6.1 (and the first with Cabal 3.10.3 is GHC 9.8.3). I’ve tried overriding Cabal/Cabal-syntax/cabal-install for GHCs older than 9.8.3, but I still get the complaint “Unsupported cabal-version 3.10.3.” Interestingly, the workaround I managed to find is if I override Cabal to 3.10.3.0, but let cabal-version be set to something older, it works. Maybe this is actually the correct thing – the Cabal file can be parsed with an older Cabal, but Setup requires the non-broken one?
It sounds like you should be using setup-depends: Cabal >= 3.10.3.0 because I think cabal-version is for the syntax and supported keywords in the Cabal package declaration.
https://cabal.readthedocs.io/en/3.4/cabal-package.html#pkg-field-custom-setup-setup-depends
18:37:52
@sellout:matrix.orgsellout I’m using setup-depends already (because of another Cabal bug), and yeah, that plus the Cabal override is my workaround, which /does/ work. It’s good to hear that that distinguishing the two references to Cabal is useful. But it does leave a few open questions 1. Nix (cabal2nix?) doesn’t pay any attention to setup-depends bounds (if I don’t override Cabal, it complains that it couldn’t load the plugin, not that the bound wasn’t satisfied – which is bad for discovery); 2. my Setup doesn’t actually have a direct dependency on Cabal, so it’s odd that I have to specify it at all, and 3. it still doesn’t help in the case that I would want to have a Cabal file with syntax from a Cabal newer than the one shipped with the corresponding GHC. 19:44:22
@alex:tunstall.xyzAlex Nix doesn't use cabal-install when building. It instead compiles Setup.hs directly. That may be why setup-depends bounds are ignored. 20:34:53
@alex:tunstall.xyzAlex
In reply to @sellout:matrix.org
I’m using setup-depends already (because of another Cabal bug), and yeah, that plus the Cabal override is my workaround, which /does/ work. It’s good to hear that that distinguishing the two references to Cabal is useful. But it does leave a few open questions 1. Nix (cabal2nix?) doesn’t pay any attention to setup-depends bounds (if I don’t override Cabal, it complains that it couldn’t load the plugin, not that the bound wasn’t satisfied – which is bad for discovery); 2. my Setup doesn’t actually have a direct dependency on Cabal, so it’s odd that I have to specify it at all, and 3. it still doesn’t help in the case that I would want to have a Cabal file with syntax from a Cabal newer than the one shipped with the corresponding GHC.

Nixpkgs always uses a specific version of every package.
The boot libraries, e.g. Cabal, are whatever version is built into that particular version of GHC.

It's still not entirely clear what you're trying to do.
Build failures because Cabal is too old is, as far as I can tell, working as intended.

Note that cabal-version is the version of the Cabal package description, not the version of Cabal the library, nor the version of cabal-install the executable.
It looks like there is no 3.10.3, so that could be why you get the "unsupported" error even when using a Cabal version that supports 3.12.
You should not change cabal-version unless you need syntax or fields from a newer version.

20:43:06
30 Nov 2025
@sellout:matrix.orgsellout Ok, thanks, this is helpful. I didn’t realize the cabal-version couldn’t be an arbitrary Cabal version. I also didn’t realize you could use custom-setup with build-type: Simple (the manual explicitly says “A custom-setup stanza is required for Custom and Hooks build-type, and will be ignored (with a warning) for other build types.” – but it’s not ignored, thankfully), so I was thinking the cabal-version would be the only way inform users that they need to build with a particular Cabal version. 02:03:48
@sellout:matrix.orgsellout What I’m trying to do is put ghc-options: -fplugin=NoRecursion in a Cabal file, but that’s broken in the Cabal versions bundled with GHC 9.6.1–9.8.2. 02:09:07
1 Dec 2025
@mequbic:matrix.orgiqubic (she/her)

Is it possible to downgrade my Haskell-Language-Server version for testing purposes? I'm using this shell.nix:

{ pkgs ? import <nixpkgs> {} }:
let
  src = pkgs.nix-gitignore.gitignoreSource [] ./.;
  myPkg = pkgs.haskellPackages.callCabal2nix "aoc25" src {};
in
pkgs.stdenv.mkDerivation {
  name = "aoc-shell";

  buildInputs = [
    myPkg.env.nativeBuildInputs

    pkgs.haskell-language-server
    pkgs.cabal-install
    pkgs.hlint
  ];
}
00:16:58
@mequbic:matrix.orgiqubic (she/her)It's pulling from unstable, as that's the only version of nixpkgs I have on my NixOS system.00:17:23
@mequbic:matrix.orgiqubic (she/her)Basically, something weird is happening in my Emacs with font coloring, and I want to see if it's an LSP issue or not. https://github.com/haskell/haskell-mode/issues/188400:18:20
@mequbic:matrix.orgiqubic (she/her)* It's pulling from unstable (giving me 2.12.0.0), as that's the only version of nixpkgs I have on my NixOS system.00:20:17
@me:linj.techlinj iqubic (she/her)do you use eglot? Which version? 00:23:31
@mequbic:matrix.orgiqubic (she/her)I'm using LSP mode. Not Elgot.00:24:10
@mequbic:matrix.orgiqubic (she/her) As the GitHub issue notes, Day01 and Common.* at the top are being rendered with haskell-constructor-face 00:25:17
@me:linj.techlinjThe easiest way to downgrade hls is to switch to an old nixpkgs commit whose hls is old, I guess00:25:44
@mequbic:matrix.orgiqubic (she/her)I see.00:25:55
@mequbic:matrix.orgiqubic (she/her) The issue is that I don't think these symbols should be colored with the haskell-constructor-face, because those are constructors. They are module names. 00:27:36
@alex:tunstall.xyzAlex
In reply to @mequbic:matrix.org
The issue is that I don't think these symbols should be colored with the haskell-constructor-face, because those are constructors. They are module names.

I don't know much about how HLS is implemented, but it seems like you may be able to disable the semantic highlighting by removing the plugin that implements it (see https://github.com/haskell/haskell-language-server/pull/3892) from your HLS installation. I assume there is a way of overriding the list of installed HLS plugins in Nixpkgs.

If that resolves your issue, then it's in some way caused by the semantic highlighting. If the issue persists, I find it highly doubtful that HLS is responsible.

01:03:14
@mequbic:matrix.orgiqubic (she/her)Yeah... if there's a way to disable that to test things out, I'd love to.01:03:56
@alex:tunstall.xyzAlex
In reply to @mequbic:matrix.org
Yeah... if there's a way to disable that to test things out, I'd love to.
Try adding haskell.plugin.semanticTokens.globalOn: false to your HLS config.
(See https://haskell-language-server.readthedocs.io/en/latest/configuration.html#generic-plugin-configuration, the plugin isn't listed in the docs but I found its config option in the PR.)
01:09:59
@mequbic:matrix.orgiqubic (she/her)Where is the default HLS config?01:10:19
@alex:tunstall.xyzAlexNo idea. I think that would depend on your editor or how you're starting the LSP server, so you should probably consult the relevant section of your editor's manual (since most editors start the server themselves).01:12:29
@alex:tunstall.xyzAlexBtw it seems to be default disabled on most GHC versions.01:13:43
@mequbic:matrix.orgiqubic (she/her)I'm using Emacs LSP-Mode.01:14:09
@mequbic:matrix.orgiqubic (she/her)https://emacs-lsp.github.io/lsp-mode/01:14:22
@alex:tunstall.xyzAlex Not familiar with Emacs, sorry.
You could perhaps also try checking for changes in the syntax highlighting (or in the treesitter highlighter, if the editor uses that).
01:16:36
@mequbic:matrix.orgiqubic (she/her)I'm not using treesitter. In fact, I explicitly just turned that off recently.01:17:10
@acidbong:envs.net@acidbong:envs.net moin
for defining variables that aren't supposed to be exported (like in single-file programs), what's more idiomatic/common in haskell: multiple top-level assignments before the main function or let..in block(s)?
06:08:05
@b:chreekat.netchreekat

Probably not the right room to be asking (sorry), and I'm not sure there is an option that's more idiomatic. But I'll give my own recommendations and heuristics:

  1. Always use explicit export lists so you only export the things you want exported. It's helpful to the compiler as well as your future self
  2. Anything that needs a do block usually goes on the top level
  3. lets and wheres are good for one-line unpacking or manipulating of function arguments, but it gets confusing if you can't see the place where the arguments are declared on the same screen
  4. I usually put top-level helpers after the function they are helping, and I usually use let instead of where.
  5. Nesting lets and wheres is awful
07:46:35
@acidbong:envs.net@acidbong:envs.net
In reply to @b:chreekat.net

Probably not the right room to be asking (sorry), and I'm not sure there is an option that's more idiomatic. But I'll give my own recommendations and heuristics:

  1. Always use explicit export lists so you only export the things you want exported. It's helpful to the compiler as well as your future self
  2. Anything that needs a do block usually goes on the top level
  3. lets and wheres are good for one-line unpacking or manipulating of function arguments, but it gets confusing if you can't see the place where the arguments are declared on the same screen
  4. I usually put top-level helpers after the function they are helping, and I usually use let instead of where.
  5. Nesting lets and wheres is awful
oh damn, i confused the room
09:06:53
@acidbong:envs.net@acidbong:envs.net left the room.09:08:17

There are no newer messages yet.


Back to Room ListRoom Version: 6