@@ -545,6 +545,35 @@ All parameters from `mkDerivation` function are still supported.
545545* `catchConflicts` If `true`, abort package build if a package name appears more than once in dependency tree. Default is `true`.
546546* `checkInputs` Dependencies needed for running the `checkPhase`. These are added to `buildInputs` when `doCheck = true`.
547547
548+##### Overriding Python packages
549+
550+The `buildPythonPackage` function has a `overridePythonPackage` method that
551+can be used to override the package. In the following example we create an
552+environment where we have the `blaze` package using an older version of `pandas`.
553+We override first the Python interpreter and pass
554+`packageOverrides` which contains the overrides for packages in the package set.
555+
556+```nix
557+with import <nixpkgs> {};
558+
559+(let
560+ python = let
561+ packageOverrides = self: super: {
562+ pandas = super.pandas.overridePythonPackage(old: rec {
563+ version = "0.19.1";
564+ name = "pandas-${version}";
565+ src = super.fetchPypi {
566+ pname = "pandas";
567+ inherit version;
568+ sha256 = "08blshqj9zj1wyjhhw3kl2vas75vhhicvv72flvf1z3jvapgw295";
569+ };
570+ });
571+ };
572+ in pkgs.python3.override {inherit packageOverrides;};
573+
574+in python.withPackages(ps: [ps.blaze])).env
575+```
576+
548577#### `buildPythonApplication` function
549578
550579The `buildPythonApplication` function is practically the same as `buildPythonPackage`.
@@ -754,17 +783,17 @@ In the following example we rename the `pandas` package and build it.
754783```nix
755784with import <nixpkgs> {};
756785
757−let
786+(let
758787 python = let
759788 packageOverrides = self: super: {
760− pandas = super.pandas.override {name="foo";};
789+ pandas = super.pandas.overridePythonPackage(old: {name="foo";});
761790 };
762791 in pkgs.python35.override {inherit packageOverrides;};
763792
764−in python.pkgs.pandas
793+in python.withPackages(ps: [ps.pandas])).env
765794```
766−Using `nix-build` on this expression will build the package `pandas`
767−but with the new name `foo`.
795+Using `nix-build` on this expression will build an environment that contains the
796+package `pandas` but with the new name `foo`.
768797
769798All packages in the package set will use the renamed package.
770799A typical use case is to switch to another version of a certain package.