Open deviant opened 3 years ago
Some example code (even generated code?) for haskell development environments also used this to switch between building drv
and drv.env
. Here the situation is even worse: The environment won't even work properly if drv.env
isn't used.
This is a little off-topic, but does direnv's use nix
handle this correctly? If not, we probably ought to report it there as well.
lorri shell
does set it iirc.
There was a reason why we don’t set it which should be documented somewhere in the code or git blame.
lorri shell
does set it iirc.
Just tried that, it doesn't seem to be any different?
IN_NIX_SHELL
is set within the shell itself, so if one were to do a nix-build
from within the shell (produced either via lorri direnv
, or lorri shell
, etc), it would build foo
as expected. So it is setting the variable, just not in enough places.
This seems to have the side-effect of, in Haskell projects, tricking nix-build into building drv.env
, when what you'd really want is to build drv
.
Not sure what's the cleanest way to approach this, ideally instead of exporting IN_NIX_SHELL
it could be set and unset on lorri commands only. If not possible, create a lorri build command
?
As a band-aid, I've been using IN_NIX_SHELL= nix-build && lorri watch
because lorri loses it's connection after building.
This is my default.nix
for reference:
{ pkgs ? import <nixpkgs> {}}:
pkgs.haskellPackages.developPackage {
root = ./.;
}
Describe the bug
In a regular
nix-shell
, builds are evaluated withIN_NIX_SHELL
set. This allows you to, for instance, use yourdefault.nix
directly, while adding some development dependencies when in a shell. Lorri doesn't do this, meaning expressions that work as expected innix-shell
may provide a different environment in Lorri.To Reproduce
Steps to reproduce the behavior:
Expected behavior
Metadata
Additional context
None, really. This feels like an edge case you're unlikely to run into unless you're weird.