diff options
author | Rok Garbas <rok@garbas.si> | 2016-05-07 05:04:25 +0200 |
---|---|---|
committer | Rok Garbas <rok@garbas.si> | 2016-05-07 05:04:25 +0200 |
commit | 9cd896367a2d78010dac9bc80bf7f66ec416c616 (patch) | |
tree | 0b47c528db4ead2d3144f8b58dbe0ba24dd432d4 /pkgs/development/tools/pypi2nix | |
parent | e965e42dc5946b8988045ac2ca8f7dfe3f4e6ce4 (diff) |
pypi2nix: new release
Diffstat (limited to 'pkgs/development/tools/pypi2nix')
-rw-r--r-- | pkgs/development/tools/pypi2nix/default.nix | 72 | ||||
-rw-r--r-- | pkgs/development/tools/pypi2nix/deps.nix | 68 |
2 files changed, 140 insertions, 0 deletions
diff --git a/pkgs/development/tools/pypi2nix/default.nix b/pkgs/development/tools/pypi2nix/default.nix new file mode 100644 index 0000000000000..74c537763da2c --- /dev/null +++ b/pkgs/development/tools/pypi2nix/default.nix @@ -0,0 +1,72 @@ +{ stdenv, fetchurl, python, zip, makeWrapper +}: + +let + deps = import ./deps.nix { inherit fetchurl; }; + version = "1.0.0"; + src = fetchurl { + url = "https://github.com/garbas/pypi2nix/archive/v${version}.tar.gz"; + sha256 = "1rbwkmsllg8wxv45xyvc3vh97na0zxxydcfqrvig496xkylvw2rn"; + + }; +in stdenv.mkDerivation rec { + name = "pypi2nix-${version}"; + srcs = with deps; [ src pip click setuptools zcbuildout zcrecipeegg ]; + buildInputs = [ python zip makeWrapper ]; + sourceRoot = "."; + + postUnpack = '' + mkdir -p $out/pkgs + + mv pip-*/pip $out/pkgs/pip + mv click-*/click $out/pkgs/click + mv setuptools-*/setuptools $out/pkgs/setuptools + mv zc.buildout-*/src/zc $out/pkgs/zc + mv zc.recipe.egg-*/src/zc/recipe $out/pkgs/zc/recipe + + if [ "$IN_NIX_SHELL" != "1" ]; then + if [ -e git-export ]; then + mv git-export/src/pypi2nix $out/pkgs/pypi2nix + else + mv pypi2nix*/src/pypi2nix $out/pkgs/pypi2nix + fi + fi + ''; + + commonPhase = '' + mkdir -p $out/bin + + echo "#!${python}/bin/python" > $out/bin/pypi2nix + echo "import pypi2nix.cli" >> $out/bin/pypi2nix + echo "pypi2nix.cli.main()" >> $out/bin/pypi2nix + + chmod +x $out/bin/pypi2nix + + export PYTHONPATH=$out/pkgs:$PYTHONPATH + ''; + + installPhase = commonPhase + '' + wrapProgram $out/bin/pypi2nix --prefix PYTHONPATH : "$PYTHONPATH" + ''; + + shellHook = '' + export home=`pwd` + export out=/tmp/`pwd | md5sum | cut -f 1 -d " "`-$name + + rm -rf $out + mkdir -p $out + + cd $out + runHook unpackPhase + runHook commonPhase + cd $home + + export PATH=$out/bin:$PATH + export PYTHONPATH=`pwd`/src:$PYTHONPATH + ''; + meta = { + homepage = https://github.com/garbas/pypi2nix; + description = "A tool that generates nix expressions for your python packages, so you don't have to."; + maintainers = with stdenv.lib.maintainers; [ garbas ]; + }; +} diff --git a/pkgs/development/tools/pypi2nix/deps.nix b/pkgs/development/tools/pypi2nix/deps.nix new file mode 100644 index 0000000000000..39fc9329d5ece --- /dev/null +++ b/pkgs/development/tools/pypi2nix/deps.nix @@ -0,0 +1,68 @@ +{ fetchurl +#, pypi_url ? "https://files.pythonhosted.org/packages" +, pypi_url ? "https://pypi.io/packages/source/packages" +}: + +rec { + + pipVersion = "8.1.1"; + pipHash = "6b86f11841e89c8241d689956ba99ed7"; + pipWhlHash = "22db7b6a517a09c29d54a76650f170eb"; + + setuptoolsVersion = "21.0.0"; + setuptoolsHash = "81964fdb89534118707742e6d1a1ddb4"; + setuptoolsWhlHash = "6027400d6870a7dad29952b7d2dfdc7b"; + + zcbuildoutVersion = "2.5.1"; + zcbuildoutHash = "c88947a3c021ee1509a331c4fa9be187"; + + zcrecipeeggVersion = "2.0.3"; + zcrecipeeggHash = "69a8ce276029390a36008150444aa0b4"; + + wheelVersion = "0.29.0"; + wheelHash = "555a67e4507cedee23a0deb9651e452f"; + + clickVersion = "6.6"; + clickHash = "d0b09582123605220ad6977175f3e51d"; + + pipWhl = fetchurl { + url = "https://pypi.python.org/packages/31/6a/0f19a7edef6c8e5065f4346137cc2a08e22e141942d66af2e1e72d851462/pip-${pipVersion}-py2.py3-none-any.whl"; + md5 = pipWhlHash; + }; + + setuptoolsWhl = fetchurl { + url = "https://pypi.python.org/packages/15/b7/a76624e5a3b18c8c1c8d33a5240b34cdabb08aef2da44b536a8b53ba1a45/setuptools-${setuptoolsVersion}-py2.py3-none-any.whl"; + md5 = setuptoolsWhlHash; + }; + + pip = fetchurl { + url = "${pypi_url}/source/p/pip/pip-${pipVersion}.tar.gz"; + md5 = pipHash; + }; + + setuptools = fetchurl { + url = "${pypi_url}/source/s/setuptools/setuptools-${setuptoolsVersion}.tar.gz"; + md5 = setuptoolsHash; + }; + + zcbuildout = fetchurl { + url = "${pypi_url}/source/z/zc.buildout/zc.buildout-${zcbuildoutVersion}.tar.gz"; + md5 = zcbuildoutHash; + }; + + zcrecipeegg = fetchurl { + url = "${pypi_url}/source/z/zc.recipe.egg/zc.recipe.egg-${zcrecipeeggVersion}.tar.gz"; + md5 = zcrecipeeggHash; + }; + + wheel = fetchurl { + url = "${pypi_url}/source/w/wheel/wheel-${wheelVersion}.tar.gz"; + md5 = wheelHash; + }; + + click = fetchurl { + url = "${pypi_url}/source/c/click/click-${clickVersion}.tar.gz"; + md5 = clickHash; + }; + +} |