From 99e6ca2bdc58eb70eed9a75854872f8b02fb5930 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Sat, 17 Aug 2019 16:33:13 +0100 Subject: [PATCH] python3Minimal: Add top-level for a minimal Python 3 build This builds Python without optional dependencies. We can't just use python3.override, as things like python3Minimal.withPackages would pass the wrong python derivation into these modules. --- .../interpreters/python/default.nix | 32 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/python/default.nix b/pkgs/development/interpreters/python/default.nix index c8856ea2aa30..bab7a047b15c 100644 --- a/pkgs/development/interpreters/python/default.nix +++ b/pkgs/development/interpreters/python/default.nix @@ -111,6 +111,38 @@ in { inherit passthruFun; }; + # Minimal versions of Python (built without optional dependencies) + python3Minimal = (callPackage ./cpython { + self = python3Minimal; + sourceVersion = { + major = "3"; + minor = "7"; + patch = "4"; + suffix = ""; + }; + sha256 = "0gxiv5617zd7dnqm5k9r4q2188lk327nf9jznwq9j6b8p0s92ygv"; + inherit (darwin) CF configd; + inherit passthruFun; + + # strip down that python version as much as possible + openssl = null; + readline = null; + ncurses = null; + gdbm = null; + sqlite = null; + stripConfig = true; + stripIdlelib = true; + stripTests = true; + stripTkinter = true; + rebuildBytecode = false; + stripBytecode = true; + }).overrideAttrs(old: { + pname = "python3-minimal"; + meta = old.meta // { + maintainers = []; + }; + }); + pypy27 = callPackage ./pypy { self = pypy27; sourceVersion = { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c2df042eae22..9142a33aedad 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8754,7 +8754,7 @@ in python3Packages = python3.pkgs; pythonInterpreters = callPackage ./../development/interpreters/python {}; - inherit (pythonInterpreters) python27 python35 python36 python37 python38 pypy27 pypy36; + inherit (pythonInterpreters) python27 python35 python36 python37 python38 python3Minimal pypy27 pypy36; # Python package sets. python27Packages = lib.hiPrioSet (recurseIntoAttrs python27.pkgs);