Or whatever your flake is. Mostly important that we have flake-compat.
Then do a nix flake update and ensure the nix/flake.lock file exists. At that point nix-shell (in the repo root) will start working but will use the nix/flake.nix content, and only copy files in nix/ into the store. This does limit to some extent what the flake can do, but for many devShell uses it’s sufficient.
One can have a
shell.nix
that uses theflake.nix
in a subdir. Here’s how one can do this:in
shell.nix
:in
./nix/flake.nix
:Or whatever your flake is. Mostly important that we have
flake-compat
.Then do a
nix flake update
and ensure thenix/flake.lock
file exists. At that pointnix-shell
(in the repo root) will start working but will use thenix/flake.nix
content, and only copy files innix/
into the store. This does limit to some extent what the flake can do, but for manydevShell
uses it’s sufficient.