Symptoms & scope
- An import fails under a /nix/store/...-source path.
- The same relative file is present in the working checkout.
Relevant environment
Local Git-backed Nix flakes; source filtering differs from a plain path input.
Recognizable messages (synthetic examples)
error: path '/nix/store/00000000000000000000000000000000-source/modules/example.nix' does not existTracking is only one possible cause; confirm the path and filtering.
Possible causes
These are possible explanations, not a confirmed diagnosis. Several independent faults can coexist.
- A newly created module may not yet be tracked in Git and is omitted from the flake snapshot.
- A wrong relative import, ignore rule or explicit source filter may omit the expected file.
Diagnose safely
Run one command at a time in the relevant session. Read the explanation first. Uppercase placeholders need your own values; tools and privileges vary by distribution. These commands are displayed here and never executed by the website.
Check 1
Run in the configuration repository; this is a read-only Git status query.
git status --short --untracked-files=allInterpret the result: A ?? marker on an imported module supports an untracked-source explanation. Tracked modifications alone are not the same failure.
Check 2
Replace the relative path with the imported file, from the repository root.
git ls-files --error-unmatch modules/example.nixInterpret the result: A matching path confirms tracking. A nonzero result means it is not in the index; inspect ignore rules if expected tracking was omitted.
Evidence-guided next steps
Track the intended source file
If the imported nonsecret module is untracked, add that specific file to Git and inspect the staged diff. A commit is not required merely for Nix to see a tracked working-tree file.
Precautions: Flake sources are copied into the normally world-readable Nix store. Never add plaintext credentials as a repair.
Recovery / rollback: Unstage a newly added file with git restore --staged for that path and restore its old import if needed; keep the local file.
Did this solution help you?
Correct the import or source boundary
If the file is tracked, compare the reported store-relative path with the module's actual relative import. Move intended source into the flake tree or model an external repository as an explicit input instead of reaching outside its snapshot.
Precautions: Source filters can intentionally exclude large data or secrets; preserve that intent instead of widening to the entire home directory.
Recovery / rollback: Restore the previous import and source layout plus any modified input lock entries.
Did this solution help you?
References & review
This guide was prepared from primary project or distribution sources and reviewed on the date shown. This is an editorial source check, not evidence that a fix was reproduced on your hardware. Diagnostic log examples are synthetic fixtures. Version-dependent details must be checked against your installed release.
- Official NixOS Wiki — Flakes (project or distribution documentation)
- Nix flake — source reference semantics (project or distribution documentation)