about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/interpreters
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/interpreters')
-rw-r--r--nixpkgs/pkgs/development/interpreters/dhall/build-dhall-directory-package.nix25
-rw-r--r--nixpkgs/pkgs/development/interpreters/dhall/build-dhall-github-package.nix50
-rw-r--r--nixpkgs/pkgs/development/interpreters/janet/default.nix4
-rw-r--r--nixpkgs/pkgs/development/interpreters/joker/default.nix6
-rw-r--r--nixpkgs/pkgs/development/interpreters/perl/default.nix16
-rw-r--r--nixpkgs/pkgs/development/interpreters/php/default.nix16
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix14
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/cpython/2.7/profile-task.patch21
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/cpython/3.5/profile-task.patch21
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/cpython/3.6/profile-task.patch21
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/cpython/default.nix26
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/default.nix7
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/hooks/pip-build-hook.sh3
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh3
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/sitecustomize.py12
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/tests.nix10
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/tests/test_python.py4
-rw-r--r--nixpkgs/pkgs/development/interpreters/renpy/default.nix6
18 files changed, 221 insertions, 44 deletions
diff --git a/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-directory-package.nix b/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-directory-package.nix
new file mode 100644
index 000000000000..b4401a85d141
--- /dev/null
+++ b/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-directory-package.nix
@@ -0,0 +1,25 @@
+{ buildDhallPackage, lib }:
+
+# This is a minor variation on `buildDhallPackage` that splits the `code`
+# argument into `src` and `file` in such a way that you can easily override
+# the `file`
+#
+# This function is used by `dhall-to-nixpkgs` when given a directory
+lib.makeOverridable
+  ( { # Arguments passed through to `buildDhallPackage`
+      name
+    , dependencies ? []
+    , source ? false
+
+    , src
+    , # The file to import, relative to the root directory
+      file ? "package.dhall"
+    }:
+
+    buildDhallPackage {
+      inherit name dependencies source;
+
+      code = "${src}/${file}";
+    }
+  )
+
diff --git a/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-github-package.nix b/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-github-package.nix
new file mode 100644
index 000000000000..9289e9b656d3
--- /dev/null
+++ b/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-github-package.nix
@@ -0,0 +1,50 @@
+{ buildDhallPackage, fetchFromGitHub, lib }:
+
+# This function is used by `dhall-to-nixpkgs` when given a GitHub repository
+lib.makeOverridable
+  ( { # Arguments passed through to `buildDhallPackage`
+      name
+    , dependencies ? []
+    , source ? false
+
+    , # The directory containing the Dhall files, if other than the root of the
+      # repository
+      directory ? ""
+    , # The file to import, relative to the above directory
+      file ? "package.dhall"
+
+      # Arguments passed through to `fetchFromGitHub`
+    , owner
+    , repo
+    , rev
+      # Extra arguments passed through to `fetchFromGitHub`, such as the hash
+      # or `fetchSubmodules`
+    , ...
+    }@args:
+
+    buildDhallPackage {
+      inherit name dependencies source;
+
+      code =
+        let
+          src = fetchFromGitHub ({
+            name = "${name}-source";
+
+            inherit owner repo rev;
+          } // removeAttrs args [
+            "name"
+            "dependencies"
+            "source"
+            "directory"
+            "file"
+            "owner"
+            "repo"
+            "rev"
+          ]);
+
+          prefix = lib.optionalString (directory != "") "${directory}/";
+
+        in
+          "${src}/${prefix}${file}";
+    }
+  )
diff --git a/nixpkgs/pkgs/development/interpreters/janet/default.nix b/nixpkgs/pkgs/development/interpreters/janet/default.nix
index f6f4e36532ec..32312401f963 100644
--- a/nixpkgs/pkgs/development/interpreters/janet/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/janet/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   pname = "janet";
-  version = "1.9.1";
+  version = "1.10.0";
 
   src = fetchFromGitHub {
     owner = "janet-lang";
     repo = pname;
     rev = "v${version}";
-    sha256 = "1zdiwddnppwg5zrizy2ypd449zj4mivib76h73xhvr1syl7dk7sc";
+    sha256 = "0kx3c4v0481b4xx239w10ajwp8ngq8smxzh3m77dazd89r997n1g";
   };
 
   nativeBuildInputs = [ meson ninja ];
diff --git a/nixpkgs/pkgs/development/interpreters/joker/default.nix b/nixpkgs/pkgs/development/interpreters/joker/default.nix
index 789816c34d04..823ab6d10990 100644
--- a/nixpkgs/pkgs/development/interpreters/joker/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/joker/default.nix
@@ -2,16 +2,16 @@
 
 buildGoModule rec {
   pname = "joker";
-  version = "0.15.3";
+  version = "0.15.4";
 
   src = fetchFromGitHub {
     rev = "v${version}";
     owner = "candid82";
     repo = "joker";
-    sha256 = "1pxj6flyhf522zjab1dfvxfajyx3v3rzs7l8ma7ma6b8zmwp2wdn";
+    sha256 = "1ad6cdqadd1zs9zh85zyhdiiv6ir28k28w034vzsx5zaipvy4kml";
   };
 
-  vendorSha256 = "1rn8ijq3v3fzlbyvm7g4i3qpwcl3vrl4rbcvlbzv05wxrgcw9iqb";
+  vendorSha256 = "031ban30kx84r54fj9aq96pwkz9nqh4p9yzs4l8i1wqmy52rldvl";
 
   preBuild = ''
     go generate ./...
diff --git a/nixpkgs/pkgs/development/interpreters/perl/default.nix b/nixpkgs/pkgs/development/interpreters/perl/default.nix
index cc43a7d2f858..9690dfac2f20 100644
--- a/nixpkgs/pkgs/development/interpreters/perl/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/perl/default.nix
@@ -170,11 +170,11 @@ let
       priority = 6; # in `buildEnv' (including the one inside `perl.withPackages') the library files will have priority over files in `perl`
     };
   } // optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) rec {
-    crossVersion = "1.3.2"; # Mar 21, 2020
+    crossVersion = "1.3.4"; # Jun 2, 2020
 
     perl-cross-src = fetchurl {
       url = "https://github.com/arsv/perl-cross/archive/${crossVersion}.tar.gz";
-      sha256 = "1283crdjsyi45mgdiak4jmy907mqn09frxzxp21b18hvxmfn4smq";
+      sha256 = "15wvlafhpsh9h66s3vazhx46hf8ik75473acrvf6722ijd1wpz45";
     };
 
     depsBuildBuild = [ buildPackages.stdenv.cc makeWrapper ];
@@ -194,23 +194,23 @@ in {
   perl528 = common {
     perl = pkgs.perl528;
     buildPerl = buildPackages.perl528;
-    version = "5.28.2";
-    sha256 = "1iynpsxdym4h76kgndmn3ykvwxhqz444xvaz8z2irsxkvmnlb5da";
+    version = "5.28.3";
+    sha256 = "052if351m81yhaab429i1kv77v9b15qm0g48kr6y2yjrc7bc3jdg";
   };
 
   # Maint version
   perl530 = common {
     perl = pkgs.perl530;
     buildPerl = buildPackages.perl530;
-    version = "5.30.2";
-    sha256 = "128nfdxcvxfn5kq55qcfrx2851ys8hv794dcdxbyny8rm7w7vnv6";
+    version = "5.30.3";
+    sha256 = "0vs0wwwlw47sswxaflkk4hw0y45cmc7arxx788kwpbminy5lrq1j";
   };
 
   # the latest Devel version
   perldevel = common {
     perl = pkgs.perldevel;
     buildPerl = buildPackages.perldevel;
-    version = "5.31.10";
-    sha256 = "1gvv5zs54gzb947x7ryjkaalm9rbqf8l8hwjwdm9lbfgkpg07kny";
+    version = "5.32.0-RC0";
+    sha256 = "02i6n1xa4j0ksp014yy8q0j7scjcy5mr0yd4iash2ryrrfv5yw5k";
   };
 }
diff --git a/nixpkgs/pkgs/development/interpreters/php/default.nix b/nixpkgs/pkgs/development/interpreters/php/default.nix
index 6ab682d97e6c..b56824c77238 100644
--- a/nixpkgs/pkgs/development/interpreters/php/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/php/default.nix
@@ -195,9 +195,10 @@ let
 
           hardeningDisable = [ "bindnow" ];
 
-          preConfigure = ''
-            # Don't record the configure flags since this causes unnecessary
-            # runtime dependencies
+          preConfigure =
+          # Don't record the configure flags since this causes unnecessary
+          # runtime dependencies
+          ''
             for i in main/build-defs.h.in scripts/php-config.in; do
               substituteInPlace $i \
                 --replace '@CONFIGURE_COMMAND@' '(omitted)' \
@@ -206,7 +207,14 @@ let
             done
 
             export EXTENSION_DIR=$out/lib/php/extensions
-
+          ''
+          # PKG_CONFIG need not be a relative path
+          + lib.optionalString (! lib.versionAtLeast version "7.4") ''
+            for i in $(find . -type f -name "*.m4"); do
+              substituteInPlace $i \
+                --replace 'test -x "$PKG_CONFIG"' 'type -P "$PKG_CONFIG" >/dev/null'
+            done
+          '' + ''
             ./buildconf --copy --force
 
             if test -f $src/genfiles; then
diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix
index 696be2136ecc..62aae7b22129 100644
--- a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix
@@ -12,6 +12,7 @@
 , zlib
 , self
 , configd, coreutils
+, autoreconfHook
 , python-setup-hook
 # Some proprietary libs assume UCS2 unicode, especially on darwin :(
 , ucsEncoding ? 4
@@ -22,6 +23,7 @@
 , sha256
 , passthruFun
 , static ? false
+, enableOptimizations ? (!stdenv.isDarwin)
 }:
 
 assert x11Support -> tcl != null
@@ -85,6 +87,9 @@ let
       # backported in debian since 2013.
       # https://bugs.python.org/issue13146
       ./atomic_pyc.patch
+
+      # Backport from CPython 3.8 of a good list of tests to run for PGO.
+      ./profile-task.patch
     ] ++ optionals (x11Support && stdenv.isDarwin) [
       ./use-correct-tcl-tk-on-darwin.patch
     ] ++ optionals stdenv.isLinux [
@@ -134,7 +139,9 @@ let
         --replace 'os.popen(comm)' 'os.popen("${coreutils}/bin/nproc")'
     '';
 
-  configureFlags = [
+  configureFlags = optionals enableOptimizations [
+    "--enable-optimizations"
+  ] ++ [
     "--enable-shared"
     "--with-threads"
     "--enable-unicode=ucs${toString ucsEncoding}"
@@ -182,8 +189,9 @@ let
     ++ optionals x11Support [ tcl tk xlibsWrapper libX11 ]
     ++ optional (stdenv.isDarwin && configd != null) configd;
   nativeBuildInputs =
-    optionals (stdenv.hostPlatform != stdenv.buildPlatform)
-    [ buildPackages.stdenv.cc buildPackages.python ];
+    [ autoreconfHook ]
+    ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform)
+      [ buildPackages.stdenv.cc buildPackages.python ];
 
   mkPaths = paths: {
     C_INCLUDE_PATH = makeSearchPathOutput "dev" "include" paths;
diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/profile-task.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/profile-task.patch
new file mode 100644
index 000000000000..9c085657ac9d
--- /dev/null
+++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/profile-task.patch
@@ -0,0 +1,21 @@
+Backport from CPython 3.8 of a good list of tests to run for PGO.
+
+Upstream commit:
+  https://github.com/python/cpython/commit/4e16a4a31
+
+Upstream discussion:
+  https://bugs.python.org/issue36044
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 00fdd21ce..713dc1e53 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -259,7 +259,7 @@ TCLTK_LIBS=
+ # The task to run while instrumented when building the profile-opt target.
+ # We exclude unittests with -x that take a rediculious amount of time to
+ # run in the instrumented training build or do not provide much value.
+-PROFILE_TASK=-m test.regrtest --pgo -x test_asyncore test_gdb test_multiprocessing test_subprocess
++PROFILE_TASK=-m test.regrtest --pgo test_array test_base64 test_binascii test_binop test_bisect test_bytes test_bz2 test_cmath test_codecs test_collections test_complex test_dataclasses test_datetime test_decimal test_difflib test_embed test_float test_fstring test_functools test_generators test_hashlib test_heapq test_int test_itertools test_json test_long test_lzma test_math test_memoryview test_operator test_ordered_dict test_pickle test_pprint test_re test_set test_sqlite test_statistics test_struct test_tabnanny test_time test_unicode test_xml_etree test_xml_etree_c
+ 
+ # report files for gcov / lcov coverage report
+ COVERAGE_INFO= $(abs_builddir)/coverage.info
diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/profile-task.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/profile-task.patch
new file mode 100644
index 000000000000..39d5587379ca
--- /dev/null
+++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/profile-task.patch
@@ -0,0 +1,21 @@
+Backport from CPython 3.8 of a good list of tests to run for PGO.
+
+Upstream commit:
+  https://github.com/python/cpython/commit/4e16a4a31
+
+Upstream discussion:
+  https://bugs.python.org/issue36044
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 00fdd21ce..713dc1e53 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -259,7 +259,7 @@ TCLTK_LIBS=
+ # The task to run while instrumented when building the profile-opt target.
+ # We exclude unittests with -x that take a rediculious amount of time to
+ # run in the instrumented training build or do not provide much value.
+-PROFILE_TASK=-m test.regrtest --pgo -x test_asyncore test_gdb test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_main_handling test_multiprocessing_spawn test_subprocess
++PROFILE_TASK=-m test.regrtest --pgo test_array test_base64 test_binascii test_binop test_bisect test_bytes test_bz2 test_cmath test_codecs test_collections test_complex test_dataclasses test_datetime test_decimal test_difflib test_embed test_float test_fstring test_functools test_generators test_hashlib test_heapq test_int test_itertools test_json test_long test_lzma test_math test_memoryview test_operator test_ordered_dict test_pickle test_pprint test_re test_set test_sqlite test_statistics test_struct test_tabnanny test_time test_unicode test_xml_etree test_xml_etree_c
+ 
+ # report files for gcov / lcov coverage report
+ COVERAGE_INFO= $(abs_builddir)/coverage.info
diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/profile-task.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/profile-task.patch
new file mode 100644
index 000000000000..df55da3a4132
--- /dev/null
+++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/profile-task.patch
@@ -0,0 +1,21 @@
+Backport from CPython 3.8 of a good list of tests to run for PGO.
+
+Upstream commit:
+  https://github.com/python/cpython/commit/4e16a4a31
+
+Upstream discussion:
+  https://bugs.python.org/issue36044
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 00fdd21ce..713dc1e53 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -259,7 +259,7 @@ TCLTK_LIBS=
+ # The task to run while instrumented when building the profile-opt target.
+ # We exclude unittests with -x that take a rediculious amount of time to
+ # run in the instrumented training build or do not provide much value.
+-PROFILE_TASK=-m test.regrtest --pgo
++PROFILE_TASK=-m test.regrtest --pgo test_array test_base64 test_binascii test_binop test_bisect test_bytes test_bz2 test_cmath test_codecs test_collections test_complex test_dataclasses test_datetime test_decimal test_difflib test_embed test_float test_fstring test_functools test_generators test_hashlib test_heapq test_int test_itertools test_json test_long test_lzma test_math test_memoryview test_operator test_ordered_dict test_pickle test_pprint test_re test_set test_sqlite test_statistics test_struct test_tabnanny test_time test_unicode test_xml_etree test_xml_etree_c
+ 
+ # report files for gcov / lcov coverage report
+ COVERAGE_INFO= $(abs_builddir)/coverage.info
diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix
index 3ad4021d6dfe..694f661a9669 100644
--- a/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix
@@ -12,6 +12,7 @@
 , zlib
 , self
 , configd
+, autoreconfHook
 , python-setup-hook
 , nukeReferences
 # For the Python package set
@@ -30,6 +31,9 @@
 , stripBytecode ? false
 , includeSiteCustomize ? true
 , static ? false
+# Not using optimizations on Darwin
+# configure: error: llvm-profdata is required for a --enable-optimizations build but could not be found.
+, enableOptimizations ? (!stdenv.isDarwin)
 }:
 
 assert x11Support -> tcl != null
@@ -52,7 +56,9 @@ let
 
   version = with sourceVersion; "${major}.${minor}.${patch}${suffix}";
 
-  nativeBuildInputs = [
+  nativeBuildInputs = optionals (!stdenv.isDarwin) [
+    autoreconfHook
+  ] ++ [
     nukeReferences
   ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     buildPackages.stdenv.cc
@@ -107,9 +113,17 @@ in with passthru; stdenv.mkDerivation {
     # Backport a fix for discovering `rpmbuild` command when doing `python setup.py bdist_rpm` to 3.5, 3.6, 3.7.
     # See: https://bugs.python.org/issue11122
     ./3.7/fix-hardcoded-path-checking-for-rpmbuild.patch
-  ] ++ optionals (isPy37 || isPy38) [
+  ] ++ optionals (isPy37 || isPy38 || isPy39) [
     # Fix darwin build https://bugs.python.org/issue34027
     ./3.7/darwin-libutil.patch
+  ] ++ optionals (pythonOlder "3.8") [
+    # Backport from CPython 3.8 of a good list of tests to run for PGO.
+    (
+      if isPy36 || isPy37 then
+        ./3.6/profile-task.patch
+      else
+        ./3.5/profile-task.patch
+    )
   ] ++ optionals (isPy3k && hasDistutilsCxxPatch) [
     # Fix for http://bugs.python.org/issue1222585
     # Upstream distutils is calling C compiler to compile C++ code, which
@@ -118,7 +132,7 @@ in with passthru; stdenv.mkDerivation {
     (
       if isPy35 then
         ./3.5/python-3.x-distutils-C++.patch
-      else if isPy37 || isPy38 then
+      else if isPy37 || isPy38 || isPy39 then
         ./3.7/python-3.x-distutils-C++.patch
       else
         fetchpatch {
@@ -142,10 +156,14 @@ in with passthru; stdenv.mkDerivation {
 
   configureFlags = [
     "--enable-shared"
-    "--with-threads"
     "--without-ensurepip"
     "--with-system-expat"
     "--with-system-ffi"
+  ] ++ optionals enableOptimizations [
+    "--enable-optimizations"
+  ] ++ optionals (pythonOlder "3.7") [
+    # This is unconditionally true starting in CPython 3.7.
+    "--with-threads"
   ] ++ optionals (sqlite != null && isPy3k) [
     "--enable-loadable-sqlite-extensions"
   ] ++ optionals (openssl != null) [
diff --git a/nixpkgs/pkgs/development/interpreters/python/default.nix b/nixpkgs/pkgs/development/interpreters/python/default.nix
index 94e81f9a00ed..9516257cf16d 100644
--- a/nixpkgs/pkgs/development/interpreters/python/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/python/default.nix
@@ -107,10 +107,10 @@ in {
     sourceVersion = {
       major = "3";
       minor = "8";
-      patch = "2";
+      patch = "3";
       suffix = "";
     };
-    sha256 = "1ps5v323cp5czfshqjmbsqw7nvrdpcbk06f62jbzaqik4gfffii6";
+    sha256 = "0r2qg4pdvv52ld5dd95fl6lzzsxxxhbsxmymwcphh6624g3mxayz";
     inherit (darwin) configd;
     inherit passthruFun;
   };
@@ -129,7 +129,7 @@ in {
   };
 
   # Minimal versions of Python (built without optional dependencies)
-  python3Minimal = (python37.override {
+  python3Minimal = (python38.override {
     self = python3Minimal;
     pythonForBuild = pkgs.buildPackages.python3Minimal;
     # strip down that python version as much as possible
@@ -146,6 +146,7 @@ in {
     rebuildBytecode = false;
     stripBytecode = true;
     includeSiteCustomize = false;
+    enableOptimizations = false;
   }).overrideAttrs(old: {
     pname = "python3-minimal";
     meta = old.meta // {
diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/pip-build-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/pip-build-hook.sh
index 292f13d30154..6dd384b4847f 100644
--- a/nixpkgs/pkgs/development/interpreters/python/hooks/pip-build-hook.sh
+++ b/nixpkgs/pkgs/development/interpreters/python/hooks/pip-build-hook.sh
@@ -24,7 +24,8 @@ pipShellHook() {
       export PATH="$tmp_path/bin:$PATH"
       export PYTHONPATH="$tmp_path/@pythonSitePackages@:$PYTHONPATH"
       mkdir -p "$tmp_path/@pythonSitePackages@"
-      @pythonInterpreter@ -m pip install -e . --prefix "$tmp_path" >&2
+      @pythonInterpreter@ -m pip install -e . --prefix "$tmp_path" \
+         --no-build-isolation >&2
     fi
 
     runHook postShellHook
diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh
index 2aec92793825..311590425e68 100644
--- a/nixpkgs/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh
+++ b/nixpkgs/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh
@@ -29,7 +29,8 @@ setuptoolsShellHook() {
         export PATH="$tmp_path/bin:$PATH"
         export PYTHONPATH="$tmp_path/@pythonSitePackages@:$PYTHONPATH"
         mkdir -p "$tmp_path/@pythonSitePackages@"
-        eval "@pythonInterpreter@ -m pip install -e . --prefix $tmp_path >&2"
+        eval "@pythonInterpreter@ -m pip install -e . --prefix $tmp_path \
+          --no-build-isolation >&2"
     fi
 
     runHook postShellHook
diff --git a/nixpkgs/pkgs/development/interpreters/python/sitecustomize.py b/nixpkgs/pkgs/development/interpreters/python/sitecustomize.py
index 72ce951328f1..d79a4696d8ea 100644
--- a/nixpkgs/pkgs/development/interpreters/python/sitecustomize.py
+++ b/nixpkgs/pkgs/development/interpreters/python/sitecustomize.py
@@ -21,9 +21,11 @@ paths = os.environ.pop('NIX_PYTHONPATH', None)
 if paths:
     functools.reduce(lambda k, p: site.addsitedir(p, k), paths.split(':'), site._init_pathinfo())
 
-# Check whether we are in a venv. 
-# Note Python 2 does not support base_prefix so we assume we are not in a venv.
-in_venv = sys.version_info.major == 3 and sys.prefix != sys.base_prefix
+# Check whether we are in a venv or virtualenv. 
+# For Python 3 we check whether our `base_prefix` is different from our current `prefix`.
+# For Python 2 we check whether the non-standard `real_prefix` is set.
+# https://stackoverflow.com/questions/1871549/determine-if-python-is-running-inside-virtualenv
+in_venv = (sys.version_info.major == 3 and sys.prefix != sys.base_prefix) or (sys.version_info.major == 2 and hasattr(sys, "real_prefix"))
 
 if not in_venv:
     executable = os.environ.pop('NIX_PYTHONEXECUTABLE', None)
@@ -32,8 +34,6 @@ if not in_venv:
     if 'PYTHONEXECUTABLE' not in os.environ and executable is not None:
         sys.executable = executable
     if prefix is not None:
-        # Because we cannot check with Python 2 whether we are in a venv, 
-        # creating a venv from a Nix env won't work as well with Python 2.
-        # Also, note that sysconfig does not like it when sys.prefix is set to None
+        # Sysconfig does not like it when sys.prefix is set to None
         sys.prefix = sys.exec_prefix = prefix
         site.PREFIXES.insert(0, prefix)
diff --git a/nixpkgs/pkgs/development/interpreters/python/tests.nix b/nixpkgs/pkgs/development/interpreters/python/tests.nix
index 6c4a6ae8e21c..03a3b9537090 100644
--- a/nixpkgs/pkgs/development/interpreters/python/tests.nix
+++ b/nixpkgs/pkgs/development/interpreters/python/tests.nix
@@ -19,10 +19,8 @@ let
       is_nixenv = "False";
       is_virtualenv = "False";
     };
-  } // lib.optionalAttrs (python.isPy3k && !python.isPyPy) {
+  } // lib.optionalAttrs (!python.isPyPy) {
     # Use virtualenv from a Nix env.
-    # Does not function with Python 2
-    # ValueError: source and destination is the same /nix/store/38kz3j1a87cq5y59k5w7k9yk4cqgc5b2-python-2.7.18/lib/python2.7/os.py
     nixenv-virtualenv = rec {
       env = runCommand "${python.name}-virtualenv" {} ''
         ${pythonVirtualEnv.interpreter} -m virtualenv $out
@@ -39,7 +37,7 @@ let
       interpreter = env.interpreter;
       is_venv = "False";
       is_nixenv = "True";
-      is_virtualenv = "True";
+      is_virtualenv = "False";
     };
   } // lib.optionalAttrs (python.isPy3k && (!python.isPyPy)) rec {
     # Venv built using plain Python
@@ -52,7 +50,7 @@ let
       interpreter = "${env}/bin/${python.executable}";
       is_venv = "True";
       is_nixenv = "False";
-      is_virtualenv = "True";
+      is_virtualenv = "False";
     };
 
   } // lib.optionalAttrs (python.pythonAtLeast "3.8") {
@@ -66,7 +64,7 @@ let
       interpreter = "${env}/bin/${pythonEnv.executable}";
       is_venv = "True";
       is_nixenv = "True";
-      is_virtualenv = "True";
+      is_virtualenv = "False";
     };
   };
 
diff --git a/nixpkgs/pkgs/development/interpreters/python/tests/test_python.py b/nixpkgs/pkgs/development/interpreters/python/tests/test_python.py
index 41a7e687d263..0fc4b8a9e91c 100644
--- a/nixpkgs/pkgs/development/interpreters/python/tests/test_python.py
+++ b/nixpkgs/pkgs/development/interpreters/python/tests/test_python.py
@@ -43,6 +43,10 @@ class TestCasePython(unittest.TestCase):
         else:
             self.assertEqual(sys.prefix, sys.base_prefix)
 
+    @unittest.skipIf(sys.version_info.major==3, "sys.real_prefix is only set by virtualenv in case of Python 2.")
+    def test_real_prefix(self):
+        self.assertTrue(hasattr(sys, "real_prefix") == IS_VIRTUALENV)
+
     def test_python_version(self):
         self.assertTrue(platform.python_version().startswith(PYTHON_VERSION))
 
diff --git a/nixpkgs/pkgs/development/interpreters/renpy/default.nix b/nixpkgs/pkgs/development/interpreters/renpy/default.nix
index d09d150bd79c..41cf4c221c6a 100644
--- a/nixpkgs/pkgs/development/interpreters/renpy/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/renpy/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, python2Packages, pkgconfig, SDL2
-, libpng, ffmpeg, freetype, glew, libGL, libGLU, fribidi, zlib
+, libpng, ffmpeg_3, freetype, glew, libGL, libGLU, fribidi, zlib
 , glib
 }:
 
@@ -32,13 +32,13 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [
     python cython wrapPython tkinter
-    SDL2 libpng ffmpeg freetype glew libGLU libGL fribidi zlib pygame_sdl2 glib
+    SDL2 libpng ffmpeg_3 freetype glew libGLU libGL fribidi zlib pygame_sdl2 glib
   ];
 
   pythonPath = [ pygame_sdl2 tkinter ];
 
   RENPY_DEPS_INSTALL = stdenv.lib.concatStringsSep "::" (map (path: path) [
-    SDL2 SDL2.dev libpng ffmpeg ffmpeg.out freetype glew.dev glew.out libGLU libGL fribidi zlib
+    SDL2 SDL2.dev libpng ffmpeg_3 ffmpeg_3.out freetype glew.dev glew.out libGLU libGL fribidi zlib
   ]);
 
   buildPhase = ''