I’d like to create a nix-shell environment for development that uses a different python version as default than nixpkgs does right now. Additionally all python modules are supposed to be built against that older python version.
First of all: Is this the correct approach to take?
If yes, there’s still a problem: The pylint package is built locally and one of its test fails. Apparently running the tests under an older python version causes one of them to fail. What can be done about that?
pytPackages = python36Packages; is unused so it doesn’t do anything. pkgs.python = pkgs.python36; Just overrides the top level attribute so it doesn’t affect the rest. In this case you probably don’t need to override it.
Overriding recursive attribute sets like pythonPackages is tricky and has changed a lot so I hope this is the most up to date and correct way to do it.
I just spent a couple hours trying to figure out how to set up a script to basically prepare a virtual environment with a specific version of Python with Nix, and the
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
incantation was most definitely the thing I was missing to figure out how to do it.
I think that the example brought up by OP (along with stuff like what kind of commands you usually want to run in the shell) would make a great ‘advanced getting started guide’ for nix (especially as an alternative to the heavy-handed Dockerfile solutions)