about summary refs log tree commit diff
path: root/doc/languages-frameworks
diff options
context:
space:
mode:
authorJoachim Schiele <js@lastlog.de>2017-03-21 00:06:51 +0100
committerGitHub <noreply@github.com>2017-03-21 00:06:51 +0100
commit91debcb482b0b6b6b8ce017d3d22eefdc90092a7 (patch)
tree0fb8a430aeeaef7775dff1c498a55afbe254ced1 /doc/languages-frameworks
parent5e0f932de0d040c93c268f8aea601bd6b3a7bfd6 (diff)
downloadnixlib-91debcb482b0b6b6b8ce017d3d22eefdc90092a7.tar
nixlib-91debcb482b0b6b6b8ce017d3d22eefdc90092a7.tar.gz
nixlib-91debcb482b0b6b6b8ce017d3d22eefdc90092a7.tar.bz2
nixlib-91debcb482b0b6b6b8ce017d3d22eefdc90092a7.tar.lz
nixlib-91debcb482b0b6b6b8ce017d3d22eefdc90092a7.tar.xz
nixlib-91debcb482b0b6b6b8ce017d3d22eefdc90092a7.tar.zst
nixlib-91debcb482b0b6b6b8ce017d3d22eefdc90092a7.zip
Update python.md (#23669)
* Update python.md

this makes it clear how to alter `attributes` by using `packageOverrides`

* Update python.md

* Update python.md

* Update python.md

* Update python.md

* Update python.md

* Update python.md
Diffstat (limited to 'doc/languages-frameworks')
-rw-r--r--doc/languages-frameworks/python.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/languages-frameworks/python.md b/doc/languages-frameworks/python.md
index 87b5668740d1..cbb979e87881 100644
--- a/doc/languages-frameworks/python.md
+++ b/doc/languages-frameworks/python.md
@@ -897,6 +897,27 @@ is executed it will attempt to download the python modules listed in
 requirements.txt. However these will be cached locally within the `virtualenv`
 folder and not downloaded again.
 
+### How to override a Python package from `configuration.nix`?
+
+If you need to change a package's attribute(s) from `configuration.nix` you could do:
+
+```nix
+  nixpkgs.config.packageOverrides = superP: {
+    pythonPackages = superP.pythonPackages.override {
+      overrides = self: super: {
+        bepasty-server = super.bepasty-server.overrideAttrs ( oldAttrs: {
+          src = pkgs.fetchgit {
+            url = "https://github.com/bepasty/bepasty-server";
+            sha256 = "9ziqshmsf0rjvdhhca55sm0x8jz76fsf2q4rwh4m6lpcf8wr0nps";
+            rev = "e2516e8cf4f2afb5185337073607eb9e84a61d2d";
+          };
+        });
+      };
+    };
+  };
+```
+
+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`). 
 
 ## Contributing