summary refs log tree commit diff
path: root/doc/languages-frameworks/python.md
diff options
context:
space:
mode:
authorJosef Kemetmueller <josef.kemetmueller@gmail.com>2017-06-10 12:18:10 +0200
committerJosef Kemetmueller <josef.kemetmueller@gmail.com>2017-06-10 12:18:10 +0200
commit7116da8018e9015220c19fc8e3702f02834c6aeb (patch)
treed929f0e51582f37fbe6d85b022058d5ea1db8cc9 /doc/languages-frameworks/python.md
parentd7a5f07650daf9fcd5a55422c7458ab07eace686 (diff)
downloadnixpkgs-7116da8018e9015220c19fc8e3702f02834c6aeb.tar
nixpkgs-7116da8018e9015220c19fc8e3702f02834c6aeb.tar.gz
nixpkgs-7116da8018e9015220c19fc8e3702f02834c6aeb.tar.bz2
nixpkgs-7116da8018e9015220c19fc8e3702f02834c6aeb.tar.lz
nixpkgs-7116da8018e9015220c19fc8e3702f02834c6aeb.tar.xz
nixpkgs-7116da8018e9015220c19fc8e3702f02834c6aeb.tar.zst
nixpkgs-7116da8018e9015220c19fc8e3702f02834c6aeb.zip
Python docs: Add example for overlays
Diffstat (limited to 'doc/languages-frameworks/python.md')
-rw-r--r--doc/languages-frameworks/python.md22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/languages-frameworks/python.md b/doc/languages-frameworks/python.md
index c17739825bc..3c9df2e6e82 100644
--- a/doc/languages-frameworks/python.md
+++ b/doc/languages-frameworks/python.md
@@ -923,6 +923,28 @@ If you need to change a package's attribute(s) from `configuration.nix` you coul
 
 If you are using the `bepasty-server` package somewhere, for example in `systemPackages` or indirectly from `services.bepasty`, then a `nixos-rebuild switch` will rebuild the system but with the `bepasty-server` package using a different `src` attribute. This way one can modify `python` based software/libraries easily. Using `self` and `super` one can also alter dependencies (`buildInputs`) between the old state (`self`) and new state (`super`). 
 
+### How to override a Python package using overlays?
+
+To alter a python package using overlays, you would use the following approach:
+
+```nix
+self: super:
+rec {
+  python = super.python.override {
+    packageOverrides = python-self: python-super: {
+      bepasty-server = python-super.bepasty-server.overrideAttrs ( oldAttrs: {
+        src = self.pkgs.fetchgit {
+          url = "https://github.com/bepasty/bepasty-server";
+          sha256 = "9ziqshmsf0rjvdhhca55sm0x8jz76fsf2q4rwh4m6lpcf8wr0nps";
+          rev = "e2516e8cf4f2afb5185337073607eb9e84a61d2d";
+        };
+      });
+    };
+  };
+  pythonPackages = python.pkgs;
+}
+```
+
 ## Contributing
 
 ### Contributing guidelines