This commit is contained in:
Domen Kožar 2015-02-15 18:22:14 +01:00
parent 59d2ab6563
commit ef8aaa5571

View File

@ -283,24 +283,24 @@ are provided with all modules included.</para>
<filename>pkgs/development/python-modules/generic/default.nix</filename></link>. <filename>pkgs/development/python-modules/generic/default.nix</filename></link>.
Example usage: Example usage:
<programlisting language="nix"> <programlisting language="nix">
twisted = buildPythonPackage { twisted = buildPythonPackage {
name = "twisted-8.1.0"; name = "twisted-8.1.0";
src = pkgs.fetchurl { src = pkgs.fetchurl {
url = http://tmrc.mit.edu/mirror/twisted/Twisted/8.1/Twisted-8.1.0.tar.bz2; url = http://tmrc.mit.edu/mirror/twisted/Twisted/8.1/Twisted-8.1.0.tar.bz2;
sha256 = "0q25zbr4xzknaghha72mq57kh53qw1bf8csgp63pm9sfi72qhirl"; sha256 = "0q25zbr4xzknaghha72mq57kh53qw1bf8csgp63pm9sfi72qhirl";
}; };
propagatedBuildInputs = [ self.ZopeInterface ]; propagatedBuildInputs = [ self.ZopeInterface ];
meta = { meta = {
homepage = http://twistedmatrix.com/; homepage = http://twistedmatrix.com/;
description = "Twisted, an event-driven networking engine written in Python"; description = "Twisted, an event-driven networking engine written in Python";
license = stdenv.lib.licenses.mit; license = stdenv.lib.licenses.mit;
}; };
}; };
</programlisting> </programlisting>
Most of Python packages that use <varname>buildPythonPackage</varname> are defined Most of Python packages that use <varname>buildPythonPackage</varname> are defined
in <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/python-packages.nix"><filename>pkgs/top-level/python-packages.nix</filename></link> in <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/python-packages.nix"><filename>pkgs/top-level/python-packages.nix</filename></link>
@ -428,16 +428,14 @@ are provided with all modules included.</para>
<para> <para>
Create Python environments using low-level <function>pkgs.buildEnv</function> function. Example <filename>default.nix</filename>: Create Python environments using low-level <function>pkgs.buildEnv</function> function. Example <filename>default.nix</filename>:
<programlisting language="nix"> <programlisting language="nix">
<![CDATA[ <![CDATA[with import <nixpkgs> {};
with import <nixpkgs> {};
python.buildEnv.override { python.buildEnv.override {
extraLibs = [ pkgs.pythonPackages.pyramid ]; extraLibs = [ pkgs.pythonPackages.pyramid ];
ignoreCollisions = true; ignoreCollisions = true;
} }]]>
]]> </programlisting>
</programlisting>
Running <command>nix-build</command> will create Running <command>nix-build</command> will create
<filename>/nix/store/cf1xhjwzmdki7fasgr4kz6di72ykicl5-python-2.7.8-env</filename> <filename>/nix/store/cf1xhjwzmdki7fasgr4kz6di72ykicl5-python-2.7.8-env</filename>
@ -507,22 +505,23 @@ exist in community to help save time. No tool is preferred at the moment.
<command>${python.interpreter} setup.py develop</command> for the package. <command>${python.interpreter} setup.py develop</command> for the package.
</para> </para>
<warning><para><varname>shellPhase</varname> is executed only if <filename>setup.py</filename>
exists.</para></warning>
<para> <para>
Given a <filename>default.nix</filename>: Given a <filename>default.nix</filename>:
<programlisting language="nix"> <programlisting language="nix">
<![CDATA[ <![CDATA[with import <nixpkgs> {};
with import <nixpkgs> {};
buildPythonPackage { buildPythonPackage {
name = "myproject"; name = "myproject";
buildInputs = with pkgs.pythonPackages; [ pyramid ]; buildInputs = with pkgs.pythonPackages; [ pyramid ];
src = ./.; src = ./.;
} }]]>
]]> </programlisting>
</programlisting>
Running <command>nix-shell</command> with no arguments should give you Running <command>nix-shell</command> with no arguments should give you
the environment in which the package would be build with the environment in which the package would be build with
@ -615,11 +614,11 @@ sed -i '/ = data_files/d' setup.py</programlisting>
<section xml:id="ssec-language-ruby"><title>Ruby</title> <section xml:id="ssec-language-ruby"><title>Ruby</title>
<para>For example, to package yajl-ruby package, use gem-nix:</para> <para>For example, to package yajl-ruby package, use gem-nix:</para>
<screen> <screen>
$ nix-env -i gem-nix $ nix-env -i gem-nix
$ gem-nix --no-user-install --nix-file=pkgs/development/interpreters/ruby/generated.nix yajl-ruby $ gem-nix --no-user-install --nix-file=pkgs/development/interpreters/ruby/generated.nix yajl-ruby
$ nix-build -A rubyPackages.yajl-ruby $ nix-build -A rubyPackages.yajl-ruby
</screen> </screen>
</section> </section>