about summary refs log tree commit diff
path: root/pkgs/tools/admin/amazon-ec2-utils/default.nix
blob: 2dc91f037a9804df3dd95aa1691f8d9e1fc812d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ stdenv
, lib
, fetchFromGitHub
, curl
, python3
}:
stdenv.mkDerivation rec {
  pname = "amazon-ec2-utils";
  version = "1.3";

  src = fetchFromGitHub {
    owner = "aws";
    repo = "amazon-ec2-utils";
    rev = version;
    hash = "sha256:04dpxaaca144a74r6d93q4lp0d5l32v07rldj7v2v1c6s9nsf4mv";
  };

  buildInputs = [
    python3
  ];

  propagatedBuildInputs = [
    curl
  ];

  installPhase = ''
    mkdir -p $out/bin/

    cp ebsnvme-id $out/bin/
    cp ec2-metadata $out/bin/
    cp ec2udev-vbd $out/bin/
    cp ec2udev-vcpu $out/bin/

    chmod +x $out/bin/*
  '';

  doInstallCheck = true;

  # We cannot run
  #     ec2-metadata --help
  # because it actually checks EC2 metadata even if --help is given
  # so it won't work in the test sandbox.
  installCheckPhase = ''
    $out/bin/ebsnvme-id --help
  '';

  meta = with lib; {
    homepage = "https://github.com/aws/amazon-ec2-utils";
    description = "Contains a set of utilities and settings for Linux deployments in EC2";
    license = licenses.mit;
    maintainers = with maintainers; [ ketzacoatl ];
  };
}