# Adding flake.nix with out git tracking it

**URL:** https://discourse.nixos.org/t/adding-flake-nix-with-out-git-tracking-it/42806
**Category:** Help
**Created:** [April 5, 2024, 3:23pm UTC](https://discourse.nixos.org/t/adding-flake-nix-with-out-git-tracking-it/42806 "2024-04-05T15:23:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jossephus](https://discourse.nixos.org/user_avatar/discourse.nixos.org/jossephus/32/16716_2.png) [@jossephus](https://discourse.nixos.org/u/jossephus)
#### Post date: [April 5, 2024, 3:23pm UTC](https://discourse.nixos.org/t/adding-flake-nix-with-out-git-tracking-it/42806/1 "2024-04-05T15:23:22Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![VTimofeenko](https://discourse.nixos.org/user_avatar/discourse.nixos.org/vtimofeenko/32/13075_2.png) [@VTimofeenko](https://discourse.nixos.org/u/VTimofeenko)
#### Post date: [April 5, 2024, 3:50pm UTC](https://discourse.nixos.org/t/adding-flake-nix-with-out-git-tracking-it/42806/2 "2024-04-05T15:50:37Z")

</div>

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

---

<div class="post-metadata">

### Author: ![gvolpe](https://discourse.nixos.org/user_avatar/discourse.nixos.org/gvolpe/32/2721_2.png) [@gvolpe](https://discourse.nixos.org/u/gvolpe)
#### Post date: [April 5, 2024, 4:26pm UTC](https://discourse.nixos.org/t/adding-flake-nix-with-out-git-tracking-it/42806/3 "2024-04-05T16:26:29Z")

</div>

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 😄 ).

---

<div class="post-metadata">

### Author: ![Infinisil](https://discourse.nixos.org/user_avatar/discourse.nixos.org/infinisil/32/26523_2.png) [@Infinisil](https://discourse.nixos.org/u/Infinisil)
#### Post date: [April 5, 2024, 5:00pm UTC](https://discourse.nixos.org/t/adding-flake-nix-with-out-git-tracking-it/42806/4 "2024-04-05T17:00:12Z")

</div>

See [Can I use flakes within a git repo without committing flake.nix?](https://discourse.nixos.org/t/can-i-use-flakes-within-a-git-repo-without-committing-flake-nix/18196) 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](https://discourse.nixos.org/t/can-i-use-flakes-within-a-git-repo-without-committing-flake-nix/18196/5)
