I鈥檇 like to override a Python package from an overlay by replacing it completely using another .nix
file using callPackage
. I tried to adapt the various guides like Overlays - NixOS Wiki, Using python.withPackages with nixpkgs-overlays does not work 路 Issue #26487 路 NixOS/nixpkgs 路 GitHub or How I can successfully override a python lib with overlays?, leading to an overlay like this:
final: prev:
rec {
python310 = prev.python310.override {
packageOverrides = pyfinal: pyprev: {
tzlocal = final.callPackage ../tzlocal.nix
{
inherit (final.python310.pkgs) buildPythonPackage pythonOlder setuptools wheel pytz-deprecation-shim pytest-mock pytestCheckHook;
};
};
};
python310Packages = python310.pkgs;
tzlocal = final.callPackage ../tzlocal.nix {
inherit (final.python310.pkgs) buildPythonPackage pythonOlder setuptools wheel pytz-deprecation-shim pytest-mock pytestCheckHook;
};
}
This way, ../tzlocal.nix
should be used instead of the file from nixpkgs
. The tzlocal
Python package isn鈥檛 overridden, though. When trying to install it directly as python3.10-tzlocal
, the original package from nixpkgs
is installed. Same goes when installing a package that depends on tzlocal
. I also tried overriding python3
or python
instead, but it did not make a difference.
../tzlocal.nix
is processed, though. It鈥檚 just not used as a replacement for the original package file.
How to best override the Python package?