Nix Flakes work only work the first Time?

I am using Nix-Flakes for development environments. I have created a folder of templates for basic Flakes. It appears I can only use Flakes one time.

cd new_project
nix flake init
cp ~/Templates/rustflake.nix ./flake.nix #copying the template and renaming it to flake.nix
nix develop
cargo init #works -> flake seems functional

this works like a charm. But if i open another Terminal (even after closing this one), or redo the command

nix develop

I get the following error

error: path '/nix/store/0ccnxa25whszw7mgbgyzdm4nqc0zwnm8-source/flake.nix' does not exist

PS: This Problem also persists if I only copy the Raw Text Content of the Flake, i. e. it should have nothing to do with the Metadata of flake.nix

I am very confused as I have flakes on my system that seem to be working. I’d be thankful for any help in how to solve or avoid this problem, or any explanation on why this happens.

git-add the necessary files

How though? What files are even Missing

nix flake init doesn’t initialize a git repo, so there’s no git repo to git-add files to.

EDIT: Ah, I see. @Echsm cargo init initialized a git repo. And when using flakes in a git repo, only the tracked files are included. So yes, you need to git add .

That makes so much sense, Thank you so much