Can I use flakes within a git repo without committing flake.nix?

So for the problem where you want to keep a flake.nix to provide a dev environment for a repo. Why not put that repo in a subdirectory and keep your flake.nix/flake.lock/.envrc in the directory above?

Like this:

embassy-rs-dev/  
   flake.nix      <-- my flake just for `nix develop`
   flake.lock
   .envrc
   embassy/    <-- repo I'm working on

Could also make embassy-rs-dev into a repo that has embassy as a submodule. Then the versions of the flake.nix and the embassy repo are linked.

Edit: It appears that it matters a lot whether embassy-rs-dev is a repo or not. If it is not a repo, I get

copying ~/bburdette/op-code/embassy-rs-dev

Every time I nix develop. If I specify nix develop path:., it still does the copy.

But if embassy-rs-dev is a repo, then nix-develop is instant.

3 Likes