!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 infrastructure133 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
25 Aug 2025
@maralorn:maralorn.demaralornIt is a very simple change, yes. But we nix maintainers need to wait for it to propagate through every package in the ecosystem to adopt it. And that is one of the many reasons that we can't deliver the deployment speed that you apparently expect.13:57:51
@kephaspierre:matrix.orgPierre Thierry Damnit, all this time, I hadn't see that someone had already added an example of how to add build tools with developPackages… It wasn't there the first time I read that page and I didn't spot the addition. 15:05:13
@kephaspierre:matrix.orgPierre Thierry I'm using direnv-nix and if I put developPackage in my default.nix, nix-build will put the environment in result instead of building the package, is there a way to use developPackage with nix-build within direnv-nix? 15:15:25
@alex:tunstall.xyzAlex
In reply to @kephaspierre:matrix.org
I'm using direnv-nix and if I put developPackage in my default.nix, nix-build will put the environment in result instead of building the package, is there a way to use developPackage with nix-build within direnv-nix?
I'm not sure about what exactly the tool is doing but I suspect that either shell.nix (file preferred by nix-shell) or inNixShell (option automatically enabled by nix-shell) can solve your problem.
15:22:19
@maralorn:maralorn.demaralorngenerally I don’t think that direnv-nix does anything special. If nix-shell works, then direnv-nix should also work.15:24:53
@maralorn:maralorn.demaralornAh, but your problem is the other way around.15:27:04
@maralorn:maralorn.demaralornI actually don’t use developPackage, but the wiki seems pretty clear on how to use it. What you describe should not be happening. You can share your default.nix, then maybe we can see a typo or something.15:28:56
@kephaspierre:matrix.orgPierre Thierry

This is the faulty default.nix:

{ pkgs ? import ./utils/pinned-nixpkgs.nix }: # 24.05

pkgs.haskellPackages.developPackage {
  root = ./.;
  modifier = drv: pkgs.haskell.lib.addBuildTools drv (with pkgs; [ shake haskell-language-server hlint ]);
}
15:47:50
@kephaspierre:matrix.orgPierre Thierry (and it works perfectly fine as shell.nix) 15:48:24
@kephaspierre:matrix.orgPierre Thierry I was hoping I get stop having a separate default.nix and shell.nix, but if default.nix is just pkgs.haskellPackages.callCabal2nix "my-project" ./. {}, that's not a big issue. It's more a question of knowing why this doesn't work at this point. 15:50:09
@maralorn:maralorn.demaralornYeah. I would expect this to just work(TM) as a default.nix with nix-build.15:52:52
@sternenseemann:systemli.orgsterni Pierre Thierry: As I've outlined in my response in the thread. developPackage behaves differently based on whether IN_NIX_SHELL is set. direnv presumably inherits this variable when exporting the variables set in the shell environment. nix-build does not unset this environment variable. If you want to continue using developPackage, I'd recommend manually unsetting IN_NIX_SHELL after the use nix directive in .envrc 16:09:49
@sternenseemann:systemli.orgsterni This is more or less why I wouldn't recommend using developPackage anymore. It tries to do the right thing magically, but is not very flexible. Also nowadays, code relying on IN_NIX_SHELL (see lib.inNixShell) has become rare (since there is no equivalent in pure-eval, flakes etc. which grow increasingly popular), so users no longer expect this behavior. 16:11:12
@sternenseemann:systemli.orgsternihttps://nixos.org/manual/nixpkgs/stable/#function-library-lib.trivial.inNixShell now that's a bad docstring16:27:41
@sternenseemann:systemli.orgsternihttps://github.com/NixOS/nixpkgs/issues/43681417:49:55

Show newer messages


Back to Room ListRoom Version: 6