.gitignore for Nix
4 ignore rules for Nix, ready to copy into your repository.
Purely functional package manager
The complete .gitignore for Nix
# Generated by LFGitignore - https://lfgitignore.com
# Created: 2026-09-17 17:01:12 UTC
# Technologies: Nix
### Nix ###
result
result-*
.direnv
**/.nixos-test-history
What these Nix rules actually ignore
Every pattern below, and why it belongs in your .gitignore.
Ignore build outputs from performing a nix-build or `nix build` command
| Pattern | What it ignores |
|---|---|
result |
Ignore build outputs from performing a nix-build or `nix build` command |
result-* |
Ignore build outputs from performing a nix-build or `nix build` command |
Ignore automatically generated direnv output
| Pattern | What it ignores |
|---|---|
.direnv |
Ignore automatically generated direnv output |
Ignore NixOS interactive test driver history
| Pattern | What it ignores |
|---|---|
**/.nixos-test-history |
Ignore NixOS interactive test driver history |
How to use this .gitignore for Nix
- Copy the Nix rules above, or download the file directly.
- Create a file named .gitignore at the root of your Git repository and paste the rules into it.
- If some of those files are already tracked, run git rm -r --cached . then commit again — Git only applies ignore rules to untracked files.
- Commit the .gitignore so everyone on the team shares the same rules.