I’d 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’t 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’s just not used as a replacement for the original package file.
How to best override the Python package?