How to debug expression evaluation?

Hi all,

I’ve created a file shell.nix, with the following contents:

with import <nixpkgs> {};

(pkgs.python3.withPackages (ps: with ps; [
  callPackage <nixpkgs>/pkgs/development/python-packages/python-redis-lock {
    inherit buildPythonPackage fetchPypi redis pytest process-tests;
    withDjango = true;
  }
])).env

I am doing this in an attempt to build and test the mentioned package python-redis-lock with the value withDjano = true.

However, if I run nix-shell -I nixpkgs=/home/klaas/nixpkgs/master/ --run python, nothing really seems to happen. I.e. nothing gets buidlt on my screen,
Also, the resulting python shell does in fact not have the redis_lock pacakage available for import.

I’ve obviously made some mistake, and I’d love to hear what it is.

However, I am even more interested in tools to get a handle on this mistake myself.

I.e. what kind of commands could I run / tracing can I add to really get a sense of what is going on in the above expression?

many thanks in advance,
Klaas

1 Like

I don’t know about the general case, but in this specific case, <nixpkgs>/pkgs/development/python-packages/python-redis-lock is invalid and you want instead <nixpkgs/pkgs/development/python-packages/python-redis-lock>.

I believe the syntax <nixpkgs>/pkgs is trying to call <nixpkgs> as a function and passing it /pkgs as a path, which is an error since <nixpkgs> is not a function.