Scoping rules

Nix is statically scoped, but with multiple scopes and shadowing rules.

  • primary scope: explicitly-bound variables

  • secondary scope: implicitly-bound variables

Primary scope takes precedence over secondary scope. See with for a detailed example.