···1006If you need to change a package's attribute(s) from `configuration.nix` you could do:
10071008```nix
1009- nixpkgs.config.packageOverrides = superP: {
1010- pythonPackages = superP.pythonPackages.override {
1011- overrides = self: super: {
1012- bepasty-server = super.bepasty-server.overrideAttrs ( oldAttrs: {
1013- src = pkgs.fetchgit {
1014- url = "https://github.com/bepasty/bepasty-server";
1015- sha256 = "9ziqshmsf0rjvdhhca55sm0x8jz76fsf2q4rwh4m6lpcf8wr0nps";
1016- rev = "e2516e8cf4f2afb5185337073607eb9e84a61d2d";
1017 };
1018 });
1019 };
···1021 };
1022```
10231024-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`).
000000000000010251026### How to override a Python package using overlays?
10271028-To alter a python package using overlays, you would use the following approach:
10291030```nix
1031self: super:
1032{
1033 python = super.python.override {
1034 packageOverrides = python-self: python-super: {
1035- bepasty-server = python-super.bepasty-server.overrideAttrs ( oldAttrs: {
1036- src = self.pkgs.fetchgit {
1037- url = "https://github.com/bepasty/bepasty-server";
1038- sha256 = "9ziqshmsf0rjvdhhca55sm0x8jz76fsf2q4rwh4m6lpcf8wr0nps";
1039- rev = "e2516e8cf4f2afb5185337073607eb9e84a61d2d";
1040 };
1041 });
1042 };
1043 };
1044- pythonPackages = self.python.pkgs;
1045}
1046```
1047
···1006If you need to change a package's attribute(s) from `configuration.nix` you could do:
10071008```nix
1009+ nixpkgs.config.packageOverrides = super: {
1010+ python = super.python.override {
1011+ packageOverrides = python-self: python-super: {
1012+ zerobin = python-super.zerobin.overrideAttrs (oldAttrs: {
1013+ src = super.fetchgit {
1014+ url = "https://github.com/sametmax/0bin";
1015+ rev = "a344dbb18fe7a855d0742b9a1cede7ce423b34ec";
1016+ sha256 = "16d769kmnrpbdr0ph0whyf4yff5df6zi4kmwx7sz1d3r6c8p6xji";
1017 };
1018 });
1019 };
···1021 };
1022```
10231024+`pythonPackages.zerobin` is now globally overriden. All packages and also the
1025+`zerobin` NixOS service use the new definition.
1026+Note that `python-super` refers to the old package set and `python-self`
1027+to the new, overridden version.
1028+1029+To modify only a Python package set instead of a whole Python derivation, use this snippet:
1030+1031+```nix
1032+ myPythonPackages = pythonPackages.override {
1033+ overrides = self: super: {
1034+ zerobin = ...;
1035+ };
1036+ }
1037+```
10381039### How to override a Python package using overlays?
10401041+Use the following overlay template:
10421043```nix
1044self: super:
1045{
1046 python = super.python.override {
1047 packageOverrides = python-self: python-super: {
1048+ zerobin = python-super.zerobin.overrideAttrs (oldAttrs: {
1049+ src = super.fetchgit {
1050+ url = "https://github.com/sametmax/0bin";
1051+ rev = "a344dbb18fe7a855d0742b9a1cede7ce423b34ec";
1052+ sha256 = "16d769kmnrpbdr0ph0whyf4yff5df6zi4kmwx7sz1d3r6c8p6xji";
1053 };
1054 });
1055 };
1056 };
01057}
1058```
1059
···309 # https://github.com/bos/pcap/issues/5
310 pcap = addExtraLibrary super.pcap pkgs.libpcap;
311000312 # The cabal files for these libraries do not list the required system dependencies.
313 miniball = overrideCabal super.miniball (drv: {
314 librarySystemDepends = [ pkgs.miniball ];
···309 # https://github.com/bos/pcap/issues/5
310 pcap = addExtraLibrary super.pcap pkgs.libpcap;
311312+ # https://github.com/snoyberg/yaml/issues/106
313+ yaml = disableCabalFlag super.yaml "system-libyaml";
314+315 # The cabal files for these libraries do not list the required system dependencies.
316 miniball = overrideCabal super.miniball (drv: {
317 librarySystemDepends = [ pkgs.miniball ];
···43 # a different platform, and so are disabled.
44 overrides = _: _: {};
45 extraBuildInputs = [ ]; # Old ones run on wrong platform
04647 cc = if crossSystem.useiOSPrebuilt or false
48 then buildPackages.darwin.iosSdkPkgs.clang
···43 # a different platform, and so are disabled.
44 overrides = _: _: {};
45 extraBuildInputs = [ ]; # Old ones run on wrong platform
46+ allowedRequisites = null;
4748 cc = if crossSystem.useiOSPrebuilt or false
49 then buildPackages.darwin.iosSdkPkgs.clang
···11 sha256 = "01vcqanj2sifa5i51wvrkxh55d6hrq6iq7zmnhv4ls221dqmbyyn";
12 };
1314- # Disable fstype test, tries to read /etc/mtab
15- patches = [ ./tests.patch ];
16 postPatch = ''
17 # Patch tests (both shebangs and usage in scripts)
18 for f in $(find -type f -name '*.sh'); do
···11 sha256 = "01vcqanj2sifa5i51wvrkxh55d6hrq6iq7zmnhv4ls221dqmbyyn";
12 };
130014 postPatch = ''
15 # Patch tests (both shebangs and usage in scripts)
16 for f in $(find -type f -name '*.sh'); do