Types and Tailcalls

How to specify dependencies for running python programs in NixOS

published on February 17, 2016

If we install python libraries via pythonXYPackages in NixOS, the libraries will not automatically become visible to the core python interpreter.

The best way of dealing with this is to specify the libraries as build inputs in a default.nix file and then run nix-shell to get the dependencies in the current shell. The default.nix file can look as follows:

with import <nixpkgs> {};
let p27 = python27Packages;
in
{}:
stdenv.mkDerivation {
  name = "python-nix";
  version = "0.1.0.0";
  src = ./.;
  buildInputs = [ python ansible p27.azure p27.psycopg2 p27.MySQL_python ];
}

comments powered by Disqus