!RbXGJhHMsnQcNIDFWN:nixos.org

Haskell in Nixpkgs/NixOS

724 Members
For discussions and questions about Haskell with Nix, cabal2nix and haskellPackages in nixpkgs | Current Docs: https://haskell4nix.readthedocs.io/ | More Nix: #community:nixos.org | More Haskell: #haskell-space:matrix.org145 Servers

Load older messages


SenderMessageTime
27 Mar 2025
@hellwolf:matrix.orghellwolfbeen a little quiet this week here... may I ask when can we expect nixpkgs Haskell to 9.8?12:24:07
@maralorn:maralorn.demaralornWell, it’s ready when it’s ready. 😄12:33:18
@maralorn:maralorn.demaralornI think we can do it soon.12:33:55
@maralorn:maralorn.demaralornBut I don’t think there is any progress being made because no one has time for it.12:34:32
@maralorn:maralorn.demaralorn* But I don’t think there is any progress being made because no one has time for it, currently.12:34:40
@maralorn:maralorn.demaralornI will try to get to it.12:40:33
@hellwolf:matrix.orghellwolfwhat's the good-to-go signal? I am looking at https://github.com/cdepillabout/nix-haskell-updates-status12:42:33
@hellwolf:matrix.orghellwolf

"""
🔴 Branch not mergeable

mergeable jobset failed.
maintained jobset failed.

"""

I guess this is the no-go reason?

12:43:02
@maralorn:maralorn.demaralornYes12:46:51
28 Mar 2025
@bowuigi---now-more-based:kde.org@bowuigi---now-more-based:kde.org left the room.17:46:26
@nakibrayane:matrix.orgRayane Nakib (ريّان نقيب) changed their display name from Rayane Nakib (ريان نقيب) to Rayane Nakib (ريّان نقيب).22:51:53
30 Mar 2025
@a12l:matrix.orga12lI'm currently doing Exercism's Haskell exercises. They use stack (lts-20.18) for setting up dependencies etc. What's the best way to integrate it with Nix? If it's possible I simple want some tool that automatically download and install the correct version of GHC, HLS, and the dependencies for the project15:54:45
@a12l:matrix.orga12lEach Exercise is small, so I want to do minimal amount of time and space to setup the toolchain for that exercise. 15:56:07
@a12l:matrix.orga12lIf I'd GHCUp it looks like it would work flawlessly, but from what I gather it doesn't work on NixOS?15:59:38
@alex:tunstall.xyzAlex
In reply to @a12l:matrix.org
If I'd GHCUp it looks like it would work flawlessly, but from what I gather it doesn't work on NixOS?

Unless it does something special on NixOS (I know modern Stack does), the GHC binaries that ghcup downloads are almost certainly dynamically linked and for that reason alone will not work.

Only fully statically linked executables work as-is on NixOS because they don't hardcode assumptions about how files are organised on the host.

GHC does more though: it needs to execute a C compiler and AFAIK that compiler cannot live in the same executable. Most NixOS systems don't have any C compiler installed in an easy-to-find location.

16:50:53
@alex:tunstall.xyzAlex
In reply to @a12l:matrix.org
I'm currently doing Exercism's Haskell exercises. They use stack (lts-20.18) for setting up dependencies etc. What's the best way to integrate it with Nix? If it's possible I simple want some tool that automatically download and install the correct version of GHC, HLS, and the dependencies for the project

Have you tried using Stack on NixOS? It might just work. I'm not sure.

You should get Stack from Nixpkgs, not from ghcup.

16:52:47
@a12l:matrix.orga12l

My current setup is having added

environment.systemPackages =
  [
    pkgs.ghc
    pkgs.cabal-install
    pkgs.haskell-language-server
    pkgs.haskellPackages.hlint
    pkgs.stack
  ];

in my NixOS config. When I run the tests by executing stack test in the exercise dir everything seems to work, it runs the test with GHC 9.2 (I've 9.6 globally installed) with dependencies.

But from what I understand, I've HLS compiled against my globally installed GHC version (9.6) instead of the one used in the project (9.2). Not 100 percent sure about that. Does HLS need to be specified in some stack file for it to installed?

17:35:18
@alex:tunstall.xyzAlex I don't know about Stack's ability to pull HLS, but you can override the HLS package to enable other compiler versions. 17:36:25
@b:chreekat.netchreekatIt's possible, but not straightforward. To have to add the right version of hls to the nix shell that stack automatically uses on nixos19:22:35
@b:chreekat.netchreekat* It's possible, but not straightforward. You have to add the right version of hls to the nix shell that stack automatically uses on nixos19:22:47
@alex:tunstall.xyzAlexNot really. You can just enable all versions and I think the wrapper should pick the right version?19:37:06
@b:chreekat.netchreekatMmh first of all, what I said was wrong because stack's nix shell won't help when it comes to enabling hls for an editor19:47:58
31 Mar 2025
@sellout:matrix.orgsellout I want to run doctest in the checkPhase of a derivation created by cabal2nix. I think I’m close. But, I can’t figure out how to get the GHC environment that’s used to build the package. I.e., doctest is complaining it can’t find the dependencies of the package I’m trying to test. Like command -v ghc in checkPhase is giving me a path like “/nix/store/xxx-ghc-9.6.6/bin/ghc” when I’m looking for something more like “/nix/store/xxx-ghc-9.6.6-with-packages/bin/ghc”. 06:59:00
@a12l:matrix.orga12l

When I replace pkgs.haskell-language-server with

(pkgs.haskell-language-server.override {
    supportedGhcVersions = [ "96" "92" ];
})

I get this error when trying nixos-rebuild switch --flake .#:

error: builder for '/nix/store/yx5ff3wha9qva80d7gpca686xjqx4kkn-haskell-language-server-2.9.0.0.drv' failed with exit code 1;
       last 25 log lines:
       > [11 of 13] Compiling Development.IDE.Plugin.Plugins.FillTypeWildcard ( plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/FillTypeWildcard.hs, dist/build/hls-refactor-plugin/Development/IDE/Plugin/Plugins/FillTypeWildcard.p_o )
       > [12 of 13] Compiling Development.IDE.Plugin.Plugins.ImportUtils ( plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/ImportUtils.hs, dist/build/hls-refactor-plugin/Development/IDE/Plugin/Plugins/ImportUtils.p_o )
       > [13 of 13] Compiling Development.IDE.Plugin.CodeAction ( plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs, dist/build/hls-refactor-plugin/Development/IDE/Plugin/CodeAction.p_o )
       > Preprocessing library 'hls-splice-plugin' for haskell-language-server-2.9.0.0..
       > Building library 'hls-splice-plugin' for haskell-language-server-2.9.0.0..
       >
       > <no location info>: warning: [-Wunused-packages]
       >     The following packages were specified via -package or -package-id flags,
       >     but were not needed for compilation:
       >       - ghc-exactprint-1.5.0-9oRXq6HKU5w30oFpO632kK
       > [1 of 2] Compiling Ide.Plugin.Splice.Types ( plugins/hls-splice-plugin/src/Ide/Plugin/Splice/Types.hs, dist/build/hls-splice-plugin/Ide/Plugin/Splice/Types.o, dist/build/hls-splice-plugin/Ide/Plugin/Splice/Types.dyn_o )
       > [2 of 2] Compiling Ide.Plugin.Splice ( plugins/hls-splice-plugin/src/Ide/Plugin/Splice.hs, dist/build/hls-splice-plugin/Ide/Plugin/Splice.o, dist/build/hls-splice-plugin/Ide/Plugin/Splice.dyn_o )
       >
       > <no location info>: warning: [-Wunused-packages]
       >     The following packages were specified via -package or -package-id flags,
       >     but were not needed for compilation:
       >       - ghc-exactprint-1.5.0-9oRXq6HKU5w30oFpO632kK
       > [1 of 2] Compiling Ide.Plugin.Splice.Types ( plugins/hls-splice-plugin/src/Ide/Plugin/Splice/Types.hs, dist/build/hls-splice-plugin/Ide/Plugin/Splice/Types.p_o )
       > [2 of 2] Compiling Ide.Plugin.Splice ( plugins/hls-splice-plugin/src/Ide/Plugin/Splice.hs, dist/build/hls-splice-plugin/Ide/Plugin/Splice.p_o )
       > Preprocessing library 'hls-retrie-plugin' for haskell-language-server-2.9.0.0..
       > Building library 'hls-retrie-plugin' for haskell-language-server-2.9.0.0..
       > [1 of 1] Compiling Ide.Plugin.Retrie ( plugins/hls-retrie-plugin/src/Ide/Plugin/Retrie.hs, dist/build/hls-retrie-plugin/Ide/Plugin/Retrie.o, dist/build/hls-retrie-plugin/Ide/Plugin/Retrie.dyn_o )
       > [1 of 1] Compiling Ide.Plugin.Retrie ( plugins/hls-retrie-plugin/src/Ide/Plugin/Retrie.hs, dist/build/hls-retrie-plugin/Ide/Plugin/Retrie.p_o )
       > /nix/store/1mv8pj4nxwnd9bbxshljc9p4cnl3rakj-binutils-wrapper-2.43.1/bin/ranlib: dist/build/hls-retrie-plugin/libHShaskell-language-server-2.9.0.0-BRo8Gg6usq8JRcUr14mEwc-hls-retrie-plugin-ghc9.2.8.a: error reading Internal.o: No space left on device
       > `ranlib' failed in phase `Ranlib'. (Exit code: 1)
       For full logs, run 'nix log /nix/store/yx5ff3wha9qva80d7gpca686xjqx4kkn-haskell-language-server-2.9.0.0.drv'.
error: 1 dependencies of derivation '/nix/store/zvansnmsfmx29cpgq008l7vxs66fswh0-haskell-language-server-2.9.0.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/vi2lbfb8m6dqbn6ffwkzxmk84fx730mr-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/fdr0jpvadmrh41ahzlcd47036h76v9v6-nixos-system-p-desktop2-24.11.20250323.f0946fa.drv' failed to build
09:40:28
@a12l:matrix.orga12l

No errors when I use

(pkgs.haskell-language-server.overrideAttrs (old: {
  supportedGhcVersions = [ "96" "92" ];
}))

Unsure about the difference between override and overrideAttrs

09:43:09
@a12l:matrix.orga12l But when I use overrideAttrs it doesn't seem that it installs HLS for 9.2 09:43:35
@cdepillabout:matrix.orgcdepillabout I think there is quite a few packages in nixpkgs that use doctest. The I know off the top of my head is termonad, which uses cabal-doctest. Maybe you could look at exactly what cabal-doctest is doing, and try to emulate it within your derivation? 11:33:19
@maralorn:maralorn.demaralorn a12l: Are you sure the "No space left on device" is not a problem with your system? 11:36:40
@maralorn:maralorn.demaralornIt makes sense because the build get’s bigger with the overrides that you mention.11:37:00
@maralorn:maralorn.demaralornYeah, overrideAttrs is wrong and doesn’t even throw an error, so it is a no-op.11:38:10

Show newer messages


Back to Room ListRoom Version: 6