Skip to content

NPV 161

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

NPV-161: Top-level package moved out of pkgs/by-name with custom arguments

Description

A package that was previously defined in pkgs/by-name has been moved out and is now manually defined with callPackage in all-packages.nix with a non-empty second argument. While the manual callPackage with custom arguments may still be needed, the package files should remain in pkgs/by-name.

Error message

Attribute `pkgs.{package_name}` was previously defined in {relative_package_file}, but is now manually defined as `callPackage {call_package_arg} { ... }` in {file}.
  While the manual `callPackage` is still needed, it's not necessary to move the package files.

Example

If pkgs/by-name/fo/foo3/package.nix previously existed and the package is now defined in pkgs/top-level/all-packages.nix:

self: super: {
  foo3 = self.callPackage ({ someDrv, enableFoo }: someDrv) { enableFoo = null; };
}

The error is:

Attribute `pkgs.foo3` was previously defined in pkgs/by-name/fo/foo3/package.nix, but is now manually defined as `callPackage ... { ... }` in pkgs/top-level/all-packages.nix.
  While the manual `callPackage` is still needed, it's not necessary to move the package files.

How to fix

Move the package files back to pkgs/by-name. Keep the manual callPackage in all-packages.nix to pass the custom arguments, but point it at the pkgs/by-name path:

foo3 = callPackage ../by-name/fo/foo3/package.nix { enableFoo = null; };

Clone this wiki locally