Merge pull request #9298 from abbradar/python-env

python: add .env for convenient nix-shell's
This commit is contained in:
Domen Kožar
2015-08-18 13:09:04 +02:00
2 changed files with 54 additions and 21 deletions

View File

@@ -464,6 +464,27 @@ python.buildEnv.override {
with wrapped binaries in <filename>bin/</filename>.
</para>
<para>
You can also use <varname>env</varname> attribute to create local
environments with needed packages installed (somewhat comparable to
<literal>virtualenv</literal>). For example, with the following
<filename>shell.nix</filename>:
<programlisting language="nix">
<![CDATA[with import <nixpkgs> {};
(python3.buildEnv.override {
extraLibs = with python3Packages;
[ numpy
requests
];
}).env]]>
</programlisting>
Running <command>nix-shell</command> will drop you into a shell where
<command>python</command> will have specified packages in its path.
</para>
<variablelist>
<title>
<function>python.buildEnv</function> arguments