at 15.09-beta 95 lines 2.8 kB view raw
1{ stdenv, fetchurl, pythonPackages, intltool, libvirt, libxml2Python, curl, novaclient }: 2 3with stdenv.lib; 4 5let version = "2011.2"; in 6 7stdenv.mkDerivation rec { 8 name = "nova-${version}"; 9 10 src = fetchurl { 11 url = "http://launchpad.net/nova/cactus/${version}/+download/nova-${version}.tar.gz"; 12 sha256 = "1s2w0rm332y9x34ngjz8sys9sbldg857rx9d6r3nb1ik979fx8p7"; 13 }; 14 15 patches = 16 [ ./convert.patch ]; 17 18 pythonPath = with pythonPackages; 19 [ setuptools eventlet greenlet gflags netaddr sqlalchemy carrot routes 20 paste_deploy m2crypto ipy twisted sqlalchemy_migrate 21 distutils_extra simplejson readline glance cheetah lockfile httplib2 22 # !!! should libvirt be a build-time dependency? Note that 23 # libxml2Python is a dependency of libvirt.py. 24 libvirt libxml2Python 25 novaclient 26 ]; 27 28 buildInputs = 29 [ pythonPackages.python 30 pythonPackages.wrapPython 31 pythonPackages.mox 32 intltool 33 ] ++ pythonPath; 34 35 PYTHON_EGG_CACHE = "`pwd`/.egg-cache"; 36 37 preConfigure = 38 '' 39 # Set the built-in state location to something sensible. 40 sed -i nova/flags.py \ 41 -e "/DEFINE.*'state_path'/ s|../|/var/lib/nova|" 42 43 substituteInPlace nova/virt/images.py --replace /usr/bin/curl ${curl}/bin/curl 44 45 substituteInPlace nova/api/ec2/cloud.py \ 46 --replace 'sh genrootca.sh' $out/libexec/nova/genrootca.sh 47 ''; 48 49 buildPhase = "python setup.py build"; 50 51 installPhase = 52 '' 53 p=$(toPythonPath $out) 54 export PYTHONPATH=$p:$PYTHONPATH 55 mkdir -p $p 56 python setup.py install --prefix=$out 57 58 # Nova doesn't like to be called ".nova-foo-wrapped" because it 59 # computes some stuff from its own argv[0]. So put the wrapped 60 # programs in $out/libexec under their original names. 61 mkdir -p $out/libexec/nova 62 63 wrapProgram() { 64 local prog="$1" 65 local hidden=$out/libexec/nova/$(basename "$prog") 66 mv $prog $hidden 67 makeWrapper $hidden $prog "$@" 68 } 69 70 wrapPythonPrograms 71 72 cp -prvd etc $out/etc 73 74 # Nova makes some weird assumptions about where to find its own 75 # programs relative to the Python directory. 76 ln -sfn $out/bin $out/lib/${pythonPackages.python.libPrefix}/site-packages/bin 77 78 # Install the certificate generation script. 79 cp nova/CA/genrootca.sh $out/libexec/nova/ 80 cp nova/CA/openssl.cnf.tmpl $out/libexec/nova/ 81 82 # Allow nova-manage etc. to find the proper configuration file. 83 ln -s /etc/nova/nova.conf $out/libexec/nova/nova.conf 84 ''; 85 86 doCheck = false; # !!! fix 87 88 checkPhase = "python setup.py test"; 89 90 meta = { 91 homepage = http://nova.openstack.org/; 92 description = "OpenStack Compute (a.k.a. Nova), a cloud computing fabric controller"; 93 broken = true; 94 }; 95}