| 25 Aug 2025 |
maralorn | @morgan.arnold:matrix.org One theory would be, that your flake is picking a different nixpkgs version. The template seems to be pinned to a known good version. | 07:51:34 |
mra | oh, that's bizarre. somehow didn't notice all of the weirdness in the nix/ directory... is there a straightforward way of copying over the nix/ directory and then using that as the nixpkgs input for my flake? that seems like the simplest way to ensure that the versions are all good | 08:29:59 |
Pierre Thierry | I'll try that, that's way simpler than anything already shown as example for `shellFor`! | 10:36:26 |
maralorn | mra: the nixpkgs pin in the nix/ dir should have a commit hash somewhere. You can put that commit hash in the nixpkgs input in the flake. (see nix manual for syntax) | 10:36:53 |
sterni (he/him) | An alternative is to use callCabal2nix in the packages function which would generate the expression on the fly. (Basically like developPackage, but developPackage would, I think, not work since it behaves differently depending on whether the IN_NIX_SHELL environment variable is set.) | 11:36:33 |
sterni (he/him) | Pitching the idea to target an upgrade to 9.10.3: https://discourse.nixos.org/t/call-for-contributions-we-are-updating-to-ghc-9-10-2/67756/4 | 11:37:36 |
Teo (he/him) | That's a good call IMO. There's a pretty annoying in 9.10.2 where GHC will panic if you use a constructor you havent imported but you've imported the synonymous type | 11:41:56 |
alexfmpe | wow text 2.1.2 is the gift that keeps on giving | 13:05:58 |
Uraraka ~ Ochaco | In reply to @alexfmpe:matrix.org wow text 2.1.2 is the gift that keeps on giving Isn't it just? I use T.show now. I had to change around and not use nix for packages and just use hackage because it wasn't in nix for ages | 13:13:36 |
maralorn | It 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 |
Pierre 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 |
Pierre 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 | 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 | generally I don’t think that direnv-nix does anything special. If nix-shell works, then direnv-nix should also work. | 15:24:53 |
maralorn | Ah, but your problem is the other way around. | 15:27:04 |
maralorn | I 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 |
Pierre 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 |
Pierre Thierry | (and it works perfectly fine as shell.nix) | 15:48:24 |
Pierre 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 | Yeah. I would expect this to just work(TM) as a default.nix with nix-build. | 15:52:52 |
sterni (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 |
sterni (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 |
sterni (he/him) | https://nixos.org/manual/nixpkgs/stable/#function-library-lib.trivial.inNixShell now that's a bad docstring | 16:27:41 |
sterni (he/him) | https://github.com/NixOS/nixpkgs/issues/436814 | 17:49:55 |
emily | it looks like nothing but Haskell uses it? | 18:06:05 |
mra | 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 | Oh, apparently they have a ton of overlays there to fix stuff. | 20:32:19 |
maralorn | Yes, somehow getting the niv folder in there should work. But flakes is kinda meant to be an alternative to nix. | 20:33:04 |
maralorn | Translating pins from upstream into a different dependency mechanism to track dependencies is kinda going a bit against the grain. | 20:33:42 |
maralorn | * Translating pins from upstream into a different mechanism to track dependencies is kinda going a bit against the grain. | 20:33:54 |