|
1 | | -Until proper documentation is written let this serve as an example: |
| 1 | +pypi2nix |
| 2 | +======== |
2 | 3 |
|
3 | | -1. clone this repository:: |
| 4 | +pypi2nix generates nix expressions for PyPI packages. |
4 | 5 |
|
5 | | - % git clone https://github.com/garbas/pypi2nix |
6 | | - % cd pypi2nix |
| 6 | +Quick start |
| 7 | +----------- |
7 | 8 |
|
8 | | -2. run nix-shell command and you should have ``pypi2nix`` command working:: |
| 9 | +1. Clone the repository:: |
9 | 10 |
|
10 | | - pypi2nix/ % nix-shell |
11 | | - (nix-shell) pypi2nix/ % which pypi2nix |
12 | | - /tmp/...-pypi2nix-1.0.0/bin/pypi2nix |
13 | | - |
14 | | -3. run pypi2nix on some requirements.txt file:: |
| 11 | + git clone https://github.com/garbas/pypi2nix cd pypi2nix |
15 | 12 |
|
16 | | - (nix-shell) pypi2nix/ % echo "empy" > requirements.txt |
17 | | - (nix-shell) pypi2nix/ % pypi2nix -r requirements.txt |
18 | | - (nix-shell) pypi2nix/ % ls -la requirements* |
19 | | - -rw-r--r-- 1 rok users 1064 Feb 17 23:30 requirements_generated.nix |
20 | | - -rw-r--r-- 1 rok users 311 Feb 17 23:30 requirements.nix |
21 | | - -rw-r--r-- 1 rok users 148 Feb 17 23:30 requirements_overwrite.nix |
22 | | - -rw-r--r-- 1 rok users 5 Feb 17 23:29 requirements.txt |
| 13 | +2. Inside the directory, run the ``nix-shell`` command:: |
23 | 14 |
|
24 | | -4. build your package:: |
| 15 | + nix-shell |
25 | 16 |
|
26 | | - (nix-shell) pypi2nix/ % nix-build requirements.nix -A empy |
| 17 | + Now, the ``pypi2nix`` command should be available. To check this is the |
| 18 | + case, you can run ``which pypi2nix``. |
| 19 | + |
| 20 | +3. Add the name of your package to a text file, e.g.:: |
| 21 | + |
| 22 | + echo "empy" > requirements.txt |
| 23 | + |
| 24 | + Alternatively, you can also try a URL like:: |
| 25 | + |
| 26 | + echo "https://github.com/wking/rss2email/archive/master.zip" > requirements.txt |
| 27 | + |
| 28 | +4. Run the ``pypi2nix`` command:: |
| 29 | + |
| 30 | + pypi2nix -r requirements.txt |
| 31 | + |
| 32 | + If your package requires a specific version of Python, you can use the |
| 33 | + ``-V`` option. For example, :: |
| 34 | + |
| 35 | + pypi2nix -r requirements.txt -V "3.4" |
| 36 | + |
| 37 | + If your project requires some system libraries you can use the ``-E`` |
| 38 | + option. For example, :: |
| 39 | + |
| 40 | + pypi2nix -r requirements.txt -V "3.4" -E "libxslt libxml2" |
| 41 | + |
| 42 | + Pypi2nix will now generate a file ``requirements.nix``. |
| 43 | + |
| 44 | +5. Build your package via:: |
| 45 | + |
| 46 | + nix-build requirements.nix -A empy |
| 47 | + |
| 48 | +Examples |
| 49 | +-------- |
| 50 | + |
| 51 | +The file ``examples/Makefile`` contains specific instructions for packages like |
| 52 | +``sentry``, ``empy``, ``lektor`` and ``rss2email``. |
27 | 53 |
|
28 | 54 |
|
29 | 55 | Ping me `@garbas`_ if you get stuck. |
|
0 commit comments