2016-05-07 04:04:25 +01:00
|
|
|
{ stdenv, fetchurl, python, zip, makeWrapper
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2016-09-25 03:42:23 +01:00
|
|
|
|
|
|
|
version = "1.5.0";
|
|
|
|
|
2016-05-07 04:04:25 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/garbas/pypi2nix/archive/v${version}.tar.gz";
|
2016-09-25 03:42:23 +01:00
|
|
|
sha256 = "0s79pp7gkgyk7discnv94m6z81fd67p66rdbd4cwk1ma0qljlh2k";
|
|
|
|
};
|
|
|
|
|
|
|
|
click = fetchurl {
|
|
|
|
url = "https://pypi.python.org/packages/7a/00/c14926d8232b36b08218067bcd5853caefb4737cda3f0a47437151344792/click-6.6.tar.gz";
|
|
|
|
sha256 = "1sggipyz52crrybwbr9xvwxd4aqigvplf53k9w3ygxmzivd1jsnc";
|
2016-05-07 04:04:25 +01:00
|
|
|
};
|
2016-09-25 03:42:23 +01:00
|
|
|
|
|
|
|
requests = fetchurl {
|
|
|
|
url = "https://pypi.python.org/packages/2e/ad/e627446492cc374c284e82381215dcd9a0a87c4f6e90e9789afefe6da0ad/requests-2.11.1.tar.gz";
|
|
|
|
sha256 = "0cx1w7m4cpslxz9jljxv0l9892ygrrckkiwpp2hangr8b01rikss";
|
|
|
|
};
|
|
|
|
|
2016-05-07 04:04:25 +01:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "pypi2nix-${version}";
|
2016-09-25 03:42:23 +01:00
|
|
|
srcs = [
|
2016-07-25 03:25:51 +01:00
|
|
|
src
|
|
|
|
click
|
|
|
|
requests
|
2016-09-25 03:42:23 +01:00
|
|
|
];
|
2016-05-07 04:04:25 +01:00
|
|
|
buildInputs = [ python zip makeWrapper ];
|
|
|
|
sourceRoot = ".";
|
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
mkdir -p $out/pkgs
|
|
|
|
|
|
|
|
mv click-*/click $out/pkgs/click
|
2016-07-25 03:25:51 +01:00
|
|
|
mv requests-*/requests $out/pkgs/
|
2016-05-07 04:04:25 +01:00
|
|
|
|
2016-08-15 02:46:43 +01:00
|
|
|
if [ "$IN_NIX_SHELL" != "1" ]; then
|
2016-05-07 04:04:25 +01:00
|
|
|
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
|
|
|
|
|
2016-08-15 02:46:43 +01:00
|
|
|
echo "#!${python.interpreter}" > $out/bin/pypi2nix
|
|
|
|
echo "import pypi2nix.cli" >> $out/bin/pypi2nix
|
|
|
|
echo "pypi2nix.cli.main()" >> $out/bin/pypi2nix
|
2016-05-07 04:04:25 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
2016-06-29 00:48:38 +01:00
|
|
|
|
2016-05-07 04:04:25 +01:00
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|