1{ stdenv, fetchurl, unzip, ruby, openssl, makeWrapper }:
2
3stdenv.mkDerivation rec {
4 name = "ec2-ami-tools-${version}";
5
6 version = "1.5.6";
7
8 buildInputs = [ unzip makeWrapper ];
9
10 src = fetchurl {
11 url = "http://s3.amazonaws.com/ec2-downloads/${name}.zip";
12 sha256 = "0227370qbm26qaqvscqxv6002bqwy2i5fdhbhpwfnbymh7jz59ks";
13 };
14
15 # Amazon EC2 requires that disk images are writable. If they're
16 # not, the VM immediately terminates with a mysterious
17 # "Server.InternalError" message. Since disk images generated in
18 # the Nix store are read-only, they must be made writable in the
19 # tarball uploaded to Amazon S3. So add a `--mode=0755' flag to the
20 # tar invocation.
21 patches = [ ./writable.patch ];
22
23 installPhase =
24 ''
25 mkdir -p $out
26 mv * $out
27 rm $out/*.txt
28
29 for i in $out/bin/*; do
30 wrapProgram $i \
31 --set EC2_HOME $out \
32 --prefix PATH : ${ruby}/bin:${openssl}/bin
33 done
34
35 sed -i 's|/bin/bash|${stdenv.shell}|' $out/lib/ec2/platform/base/pipeline.rb
36 ''; # */
37
38 meta = {
39 homepage = https://aws.amazon.com/developertools/Amazon-EC2/368;
40 description = "Command-line tools to create and manage Amazon EC2 virtual machine images";
41 license = stdenv.lib.licenses.amazonsl;
42 };
43
44}