11pypi2nix - generates nix expressions for PyPI packages
22======================================================
33
4+ ``pypi2nix `` is a command line tool that generates `Nix expressions `_ from
5+ different python specific sources.
46
5- 0. Ensure that Nix is installed and confiured properly
6- ------------------------------------------------------
7+ TODO: report bugs
78
8- To install nix you can simple do::
9-
10- curl https://nixos.org/nix/install | sh
11-
12-
13- 1. Clone the repository
14- -----------------------
15-
16- ::
17-
18- git clone https://github.com/garbas/pypi2nix && cd pypi2nix
9+ Ping me `@garbas `_ if you get stuck.
1910
11+ .. contents ::
2012
21- 2. Inside the directory, run the ``nix-shell `` command
22- ------------------------------------------------------
2313
24- ::
14+ 1. Installation
15+ ---------------
2516
26- nix-shell
17+ Make sure Nix is installed.::
2718
28- Now, the ``pypi2nix `` command should be available. To check this is the case,
29- you can run ``which pypi2nix ``.
19+ % curl https://nixos.org/nix/install | sh
3020
21+ Next clone `pypi2nix repository `_.::
3122
32- 3. Add the name of your package to a text file, e.g.
23+ % git clone https://github.com/garbas/pypi2nix
3324
34- ::
25+ And now install it using ` nix-env `_ command.::
3526
36- echo "empy" > requirements.txt
27+ % cd pypi2nix
28+ % nix-env -f release.nix -iA build."x86_64-linux"
3729
38- Alternatively, you can also try a URL like
3930
40- ::
31+ 2. Usage
32+ --------
4133
42- echo "https://github.com/wking/rss2email/archive/master.zip" > requirements.txt
34+ The easiest way to generate a Nix expressions is to invoke.::
4335
36+ % pypi2nix -V "3.5" -e packageA -e packageB==0.1
4437
45- 4. Run the `` pypi2nix `` command
46- -------------------------------
38+ If you also have `` requirements.txt `` file for you python project you can use
39+ `` -r `` option.::
4740
48- ::
41+
42+ % pypi2nix -V "3.5" -e packageA -e packageB==0.1 \
43+ -r requirements.txt -r requirements-dev.txt
4944
50- pypi2nix -r requirements.txt -V "2.7"
45+ What is being generated
46+ ^^^^^^^^^^^^^^^^^^^^^^^
5147
52- If your package requires a different version of Python, you can use the
53- ``-V`` option. For example, ::
48+ Option `` -V `` tells pypi2nix which python version to be used. To see which
49+ python versions are available consule `` pypi2nix --help ``.
5450
55- pypi2nix -r requirements.txt -V "3.4"
51+ Once Nix expressions are generated you should be able to see 3 new files:
5652
57- If your project requires some system libraries you can use the ``-E``
58- option. For example, ::
53+ - ``requirements_generated.nix `` - this are the generated nix expressions
5954
60- pypi2nix -r requirements.txt -V "3.4" -E "libxslt libxml2"
55+ - ``requirements_override.nix `` - this is an empty file which is ment to
56+ override generated nix expressions.
6157
62- Pypi2nix will now generate a file ``requirements.nix``.
58+ - ``requirements.nix `` is a file which connects ``requirements_generated.nix ``
59+ and ``requirements_override.nix `` and exposes it for futher usage.
6360
64- 5. Build your package via
65- -------------------------
61+ Building generated packages
62+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6663
6764Build one package::
6865
@@ -83,15 +80,33 @@ Enter developent environemnt::
8380 (nix-shell) % python -c "import empy"
8481
8582
86- Examples
87- --------
83+ .. TODO: how to override packages
84+ .. TODO: how to create default.nix
85+
8886
89- The file ``examples/Makefile `` contains specific instructions for packages like
87+ 3. Existing examples
88+ --------------------
89+
90+ The file `examples/Makefile `_ contains specific instructions for packages like
9091``sentry ``, ``empy ``, ``lektor ``, ``awscli `` and ``rss2email ``.
9192
9293
93- Ping me `@garbas `_ if you get stuck.
94+ 4. Help developing pypi2nix
95+ ---------------------------
96+
97+ Clone `pypi2nix repository `_ and using `nix-shell `_ command enter development
98+ environment.::
99+
100+ % git clone https://github.com/garbas/pypi2nix
101+ % cd pypi2nix
102+ % nix-shell
103+
104+ Code is located in ``src/pypi2nix ``.
94105
95106
107+ .. _`Nix expressions` : http://nixos.org/nix/manual/#chap-writing-nix-expressions
96108.. _`@garbas` : https://twitter.com/garbas
97- .. _`manual` : http://nixos.org/nix/manual/#name-14
109+ .. _`pypi2nix repository` : https://github.com/garbas/pypi2nix
110+ .. _`examples/Makefile` : https://github.com/garbas/pypi2nix/blob/master/examples/Makefile
111+ .. _`nix-shell` : http://nixos.org/nix/manual/#sec-nix-shell
112+ .. _`nix-env` : http://nixos.org/nix/manual/#sec-nix-env
0 commit comments