Python Openssl version

Hi all! I’m a noob.
I’m trying to create an environment with nix-shell. The requirements are: Python 2.7 and OpenSSL 1.1.1.
With the following nix file:

with import <nixpkgs> {};

stdenv.mkDerivation {
  name = "my-environment";

  buildInputs = [

Running this environment I get this output from the common shell:

[nix-shell:~]$ openssl version -a
OpenSSL 1.1.1d  10 Sep 2019

whereas with the Python interpreter i get this output:

[nix-shell:~]$ python
Python 2.7.16 (default, Mar  2 2019, 18:34:01) 
[GCC 7.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
'OpenSSL 1.0.2t  10 Sep 2019'

My target is to get OpenSSL 1.1.1d when importing it in Python (actually i get version 1.0.2t).

Where I’m wrong?
Thanks in advance!

You know that Python 2.7 is deprecated and almost unmaintained, yes? You should use Python 3! From my machine running nixos-unstable:

$ python 
Python 3.7.4 (default, Jul  8 2019, 18:31:06) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
'OpenSSL 1.1.1d  10 Sep 2019'

Anyway, to explain your example, There’s no relation between the version of pkgs.openssl_1_1 and the one used to build the Python 2.7 interpreter. You could try to override the Python package derivation and force openssl_1_1 into it, but I’m not absolutely certain that the build will succeed.