Skip to content

NPV 121

Philip Taron edited this page Feb 16, 2026 · 1 revision

NPV-121: Path interpolation in Nix file

Description

Nix files under pkgs/by-name must not contain path expressions with interpolations (e.g., ./${"foo"}). These are not yet fully supported by the checker and may resolve to paths outside the package directory.

Error message

{relative_package_dir}: File {subpath} at line {line} contains the path expression "{text}", which is not yet supported and may point outside the directory of that package.

Example

Given pkgs/by-name/aa/aa/package.nix:

{ someDrv }: someDrv // { pathWithSubexpr = ./${"test"}; }

The error is:

pkgs/by-name/aa/aa: File package.nix at line 1 contains the path expression "./${"test"}", which is not yet supported and may point outside the directory of that package.

How to fix

Avoid path interpolations in package.nix. Instead, use string interpolation or pass the path as a callPackage argument.

Clone this wiki locally