!RbXGJhHMsnQcNIDFWN:nixos.org

Haskell in Nixpkgs/NixOS

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

Load older messages


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 (he/him) 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 (he/him) 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.orgsterni (he/him)https://nixos.org/manual/nixpkgs/stable/#function-library-lib.trivial.inNixShell now that's a bad docstring16:27:41
@sternenseemann:systemli.orgsterni (he/him)https://github.com/NixOS/nixpkgs/issues/43681417:49:55
@emilazy:matrix.orgemilyit looks like nothing but Haskell uses it?18:06:05
@morgan.arnold:matrix.orgmra Unfortunately, this doesn't seem to straight-up work? If I look in the sources from the template: https://github.com/clash-lang/clash-starters/blob/main/simple-nix/nix/sources.json, and then copy the link to the version of nixpkgs that they used into my flake, I just get a new error: "Package ‘clash-prelude-1.6.6’ in [...] is marked as broken, refusing to evaluate.". Would it be possible to just copy the nix directory into my project, and then import ./nix/nixpkgs.nix or something to use as the nixpkgs input for my flake? 19:22:03
@maralorn:maralorn.demaralornOh, apparently they have a ton of overlays there to fix stuff.20:32:19
@maralorn:maralorn.demaralornYes, somehow getting the niv folder in there should work. But flakes is kinda meant to be an alternative to nix.20:33:04
@maralorn:maralorn.demaralornTranslating pins from upstream into a different dependency mechanism to track dependencies is kinda going a bit against the grain.20:33:42
@maralorn:maralorn.demaralorn* Translating pins from upstream into a different mechanism to track dependencies is kinda going a bit against the grain.20:33:54
26 Aug 2025
@morgan.arnold:matrix.orgmra Hm, maybe I'm being a bit stupid trying to turn this into a flake. I guess I could just keep the existing nix stuff from the template? I'm just mildly annoyed about not being able to use nix develop. I thought that I would just be able to do something like inputs.nixpkgs = import ./nix/nixpkgs {};, in my flake but if I do this I get the error "expected a set but got a thunk", so I guess I've misunderstood something? 02:54:59
@morgan.arnold:matrix.orgmraSorry if it's not obvious, but I'm not exactly an expert with Nix :P02:55:14
@maralorn:maralorn.demaralorn
In reply to @morgan.arnold:matrix.org
Hm, maybe I'm being a bit stupid trying to turn this into a flake. I guess I could just keep the existing nix stuff from the template? I'm just mildly annoyed about not being able to use nix develop. I thought that I would just be able to do something like inputs.nixpkgs = import ./nix/nixpkgs {};, in my flake but if I do this I get the error "expected a set but got a thunk", so I guess I've misunderstood something?
Well. The problem causing your error message is that flakes only look like nix but only a subset is allowed.
07:09:25
@maralorn:maralorn.demaralornThe problem from what I can tell is that the template uses multiple overrides to fix the build not just pinning nixpkgs. That's why you still encountered an error when you pinned the correct nixpkgs.07:10:13
@maralorn:maralorn.demaralornThe old style equivalent to nix develop would be nix-shell07:11:09
27 Aug 2025
@artem.types:matrix.orgArtemThanks guys for posting all the updates on the 9.8->9.10 PR. Very informative and helpful for explaining how the many processes work. ❤️00:39:27
@thibaut:fsl.shThibaut joined the room.13:35:37
@thibaut:fsl.shThibautHello! Is this the space to ask for a package update? I am interested in the dhall packages 🙏13:39:23
@toonn:matrix.orgtoonn Thibaut: Aren't they part of Stackage? 13:42:26

Show newer messages


Back to Room ListRoom Version: 6