Ignore the Nix build result symlink
Intent: Prevent the `/result` symlink produced by `nix-build` from appearing as an untracked file in Git. By default, `nix-build` places a `result` symlink in the current directory pointing into the Nix store. This is a local build artifact that should never be committed.
Affected files: .gitignore
@@ -51,6 +51,7 @@ ios/.build-number
.android-emulator-home/
.direnv/
emulator.log
+/result
.worktrees
worktrees
What changed
A single line (/result) was appended to the Nix/build-tooling section of .gitignore, right after the existing emulator.log entry.
Why the leading slash matters
The pattern uses a root-anchored path (/result rather than result). This means:
| Pattern | Effect |
|---|---|
result | Ignores any file or directory named result at any depth in the repo |
/result | Ignores result only at the repository root |
The root-anchored form is the correct choice here because nix-build always creates the symlink at the working directory root, and a blanket ignore could accidentally hide legitimate files named result in nested directories.
Context: Nix build workflow
When you run nix-build (or nix-build -A someAttr) in a repository that contains a default.nix or shell.nix:
- Nix evaluates the derivation and builds it in the Nix store (
/nix/store/...). - A symlink named
resultis created in the current directory pointing to the store path. - This symlink is useful for inspecting the build output locally but should not be version-controlled.
By adding /result to .gitignore, contributors who use Nix to build the project will no longer see noise in git status or risk committing the symlink.