Adding flake.nix with out git tracking it

I am not sure if the title is clear or not so let me explain. Everytime I want to contribute to open source projrcts I have I setup project level flake.nix to the projects with everything I need to build it. but when making a PR I do not want to include flake.nix and flake.lock with the pr. What workflow do people in the nix community follow for this?

Git will ignore files in .git/info/exclude. It uses the same syntax as .gitignore but is not checked into the repository.

1 Like

Either add it to your .gitignore (global if desired) as suggested, or if you use direnv, what I prefer is to add .envrc to my global .gitignore and create it in every directory where I want to have a custom nix shell, with something like:

use flake "git+file:///home/gvolpe/workspace/my-flake"

This way I don’t have to bother about convincing people of adding a flake.nix to the repo (but I’d try of course :smile: ).

1 Like

See Can I use flakes within a git repo without committing flake.nix? for the same question, where I showed a good workaround: Can I use flakes within a git repo without committing flake.nix? - #5 by Infinisil

2 Likes