Skip to content

NPV 106

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

NPV-106: Override has wrong callPackage path

Description

When a package directory exists under pkgs/by-name, the callPackage path in any manual override must point to the correct package.nix file. This error triggers when the path points to a different file.

Error message

Because {relative_package_dir} exists, the attribute `pkgs.{package_name}` must be defined like

    {package_name} = callPackage {expected_path_expr} { /* ... */ };

  However, in this PR, the first `callPackage` argument is the wrong path. See the definition in {file}:{line}:

    {package_name} = callPackage {actual_path_expr} { /* ... */ };

Example

Given pkgs/by-name/no/nonDerivation/package.nix exists, and pkgs/top-level/all-packages.nix contains:

self: super: { nonDerivation = self.callPackage ./../../someDrv.nix { }; }

The error is:

Because pkgs/by-name/no/nonDerivation exists, the attribute `pkgs.nonDerivation` must be defined like

    nonDerivation = callPackage ./../by-name/no/nonDerivation/package.nix { /* ... */ };

  However, in this PR, the first `callPackage` argument is the wrong path. See the definition in pkgs/top-level/all-packages.nix:1:

    nonDerivation = callPackage ./../../someDrv.nix { /* ... */ };

How to fix

Change the callPackage path to point to the correct package.nix:

nonDerivation = callPackage ../by-name/no/nonDerivation/package.nix { /* overrides */ };

Clone this wiki locally