···10061006If you need to change a package's attribute(s) from `configuration.nix` you could do:
1007100710081008```nix
10091009- nixpkgs.config.packageOverrides = superP: {
10101010- pythonPackages = superP.pythonPackages.override {
10111011- overrides = self: super: {
10121012- bepasty-server = super.bepasty-server.overrideAttrs ( oldAttrs: {
10131013- src = pkgs.fetchgit {
10141014- url = "https://github.com/bepasty/bepasty-server";
10151015- sha256 = "9ziqshmsf0rjvdhhca55sm0x8jz76fsf2q4rwh4m6lpcf8wr0nps";
10161016- rev = "e2516e8cf4f2afb5185337073607eb9e84a61d2d";
10091009+ nixpkgs.config.packageOverrides = super: {
10101010+ python = super.python.override {
10111011+ packageOverrides = python-self: python-super: {
10121012+ zerobin = python-super.zerobin.overrideAttrs (oldAttrs: {
10131013+ src = super.fetchgit {
10141014+ url = "https://github.com/sametmax/0bin";
10151015+ rev = "a344dbb18fe7a855d0742b9a1cede7ce423b34ec";
10161016+ sha256 = "16d769kmnrpbdr0ph0whyf4yff5df6zi4kmwx7sz1d3r6c8p6xji";
10171017 };
10181018 });
10191019 };
···10211021 };
10221022```
1023102310241024-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`).
10241024+`pythonPackages.zerobin` is now globally overriden. All packages and also the
10251025+`zerobin` NixOS service use the new definition.
10261026+Note that `python-super` refers to the old package set and `python-self`
10271027+to the new, overridden version.
10281028+10291029+To modify only a Python package set instead of a whole Python derivation, use this snippet:
10301030+10311031+```nix
10321032+ myPythonPackages = pythonPackages.override {
10331033+ overrides = self: super: {
10341034+ zerobin = ...;
10351035+ };
10361036+ }
10371037+```
1025103810261039### How to override a Python package using overlays?
1027104010281028-To alter a python package using overlays, you would use the following approach:
10411041+Use the following overlay template:
1029104210301043```nix
10311044self: super:
10321045{
10331046 python = super.python.override {
10341047 packageOverrides = python-self: python-super: {
10351035- bepasty-server = python-super.bepasty-server.overrideAttrs ( oldAttrs: {
10361036- src = self.pkgs.fetchgit {
10371037- url = "https://github.com/bepasty/bepasty-server";
10381038- sha256 = "9ziqshmsf0rjvdhhca55sm0x8jz76fsf2q4rwh4m6lpcf8wr0nps";
10391039- rev = "e2516e8cf4f2afb5185337073607eb9e84a61d2d";
10481048+ zerobin = python-super.zerobin.overrideAttrs (oldAttrs: {
10491049+ src = super.fetchgit {
10501050+ url = "https://github.com/sametmax/0bin";
10511051+ rev = "a344dbb18fe7a855d0742b9a1cede7ce423b34ec";
10521052+ sha256 = "16d769kmnrpbdr0ph0whyf4yff5df6zi4kmwx7sz1d3r6c8p6xji";
10401053 };
10411054 });
10421055 };
10431056 };
10441044- pythonPackages = self.python.pkgs;
10451057}
10461058```
10471059
···4343 # a different platform, and so are disabled.
4444 overrides = _: _: {};
4545 extraBuildInputs = [ ]; # Old ones run on wrong platform
4646+ allowedRequisites = null;
46474748 cc = if crossSystem.useiOSPrebuilt or false
4849 then buildPackages.darwin.iosSdkPkgs.clang