I’m a Nix newbie undergoing a fairly substantial packaging effort, and have several hundred auto-generated packages compiling, but I’m struggling with environment setup. For example, I know that when I do a plain nix develop
, I either get dropped into the flake’s devShell output, or if that doesn’t exist I get the develop environment of the defaultPackage output, equivalent to nix develop [that-package]
. However:
- I can’t tell what I need to do to build the
develop
shell for a package without actually entering it (for example, to cache or even just inspect it). When I donix develop foo
, I see it building afoo-env
installable— what is that thing and where is it? Is that the entirety of the shell definition, or are there hooks or other parts that are only available to the nix interpreter during evaluation? (for example, the stuff visible to invocations likenix eval .#<pkgname>.meta
) - How do I make my own derivation work with
nix shell
, for example one based onbuildEnv
(nixpkgs/default.nix at a5b3afece376f255309bf959f6651e91a1c6e1b4 · NixOS/nixpkgs · GitHub)? It didn’t seem like it was enough to just create anix-support/setup-hook
file in the postBuild— is this even possible, or is the correct strategy to have amkShell
that has abuildEnv
as abuildInput
, in the case where I want to both set up a unified symlink workspace, but also set a bunch of envvars? - The
mkShell
definition (nixpkgs/default.nix at a5b3afece376f255309bf959f6651e91a1c6e1b4 · NixOS/nixpkgs · GitHub) specifically prohibits building with itsnoBuildPhase
. Does this mean that whatever the definition is that it generates is never accessible externally? (For example, if I wanted to do something likesource path/to/thing
with it rather than needing to always launch a subshell.)
I know there are a bunch of confused bits here, and like I say I think I’ve made good headway on the packaging side, but now I’m needing to understand more of the guts of what’s going on with Nix at runtime and coming up short. Thanks!