Back to feed

sledtools/pika branch #138

gitignore-result

gitignore: ignore nix build result symlink

Target branch: master

Merge Commit: 91c2dde815cad72a72df4cecef152658b31b0ac5

branch: merged tutorial: ready ci: success
Open CI Details

Continuous Integration

CI: success

Compact status on the review page, with full logs on the CI page.

Open CI Details

Latest run #174 success

head bef8b1bb02d8d8bc0bac8146fded9db11e3e5fbb · queued 2026-03-27 01:10:04 · 0 lane(s)

queued 0s

No lanes were selected for this branch head.

Summary

This branch adds a single line to the repository's .gitignore file to ignore the /result symlink, which is the default output symlink created by nix-build. Without this entry, running a Nix build in the repository root would leave an untracked result symlink visible in git status, potentially leading to accidental commits of build artifacts.

Tutorial Steps

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

Evidence
@@ -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:

PatternEffect
resultIgnores any file or directory named result at any depth in the repo
/resultIgnores 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:

  1. Nix evaluates the derivation and builds it in the Nix store (/nix/store/...).
  2. A symlink named result is created in the current directory pointing to the store path.
  3. 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.

Diff