From 168192f116d2faaab33e4fade4756c8d4690e614 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 1 Sep 2016 15:20:49 +0200 Subject: [PATCH] python-3.5: Eliminate -dev paths from the runtime closure This reduces Python's closure size from 200 MiB to 129 MiB. Even better would be to get move tkinter to a separate output or package (since that would get rid of all X11 stuff), but that's a bit harder. --- .../interpreters/python/cpython/3.5/default.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/development/interpreters/python/cpython/3.5/default.nix b/pkgs/development/interpreters/python/cpython/3.5/default.nix index 9050679435c..a2149ddb8bd 100644 --- a/pkgs/development/interpreters/python/cpython/3.5/default.nix +++ b/pkgs/development/interpreters/python/cpython/3.5/default.nix @@ -95,6 +95,17 @@ stdenv.mkDerivation { paxmark E $out/bin/python${majorVersion} ''; + postFixup = '' + # Get rid of retained dependencies on -dev packages, and remove + # some $TMPDIR references to improve binary reproducibility. + for i in $out/lib//python${majorVersion}/_sysconfigdata.py $out/lib/python${majorVersion}/config-${majorVersion}m/Makefile; do + sed -i $i -e "s|-I/nix/store/[^ ']*||g" -e "s|$TMPDIR|/no-such-path|g" + done + + # FIXME: should regenerate this. + rm $out/lib/python${majorVersion}/__pycache__/_sysconfigdata.cpython* + ''; + passthru = rec { zlibSupport = zlib != null; sqliteSupport = sqlite != null;