about summary refs log tree commit diff
path: root/pkgs/tools/security/cliam/default.nix
blob: 8ae75142ba4d6153c9e3b4bec4cd07793cd935fc (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
{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
}:

buildGoModule rec {
  pname = "cliam";
  version = "2.0.0";

  src = fetchFromGitHub {
    owner = "securisec";
    repo = pname;
    rev = version;
    hash = "sha256-TEpAY1yY5AFTg5yUZMvTFdZiQ7yBi0rjYgCCksiMfDU=";
  };

  vendorSha256 = "sha256-VCai9rxpnlpviN5W/VIRcNGvPljE2gbFnxA1OKhVElk=";

  nativeBuildInputs = [
    installShellFiles
  ];

  ldflags = [
    "-s"
    "-w"
    "-X github.com/securisec/cliam/cli/version.Version=${version}"
  ];

  postBuild = ''
    # should be called cliam
    mv $GOPATH/bin/{cli,cliam}
  '';

  postInstall = ''
    installShellCompletion --cmd cliam \
      --bash <($out/bin/cliam completion bash) \
      --fish <($out/bin/cliam completion fish) \
      --zsh <($out/bin/cliam completion zsh)
  '';

  meta = with lib; {
    description = "Cloud agnostic IAM permissions enumerator";
    homepage = "https://github.com/securisec/cliam";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ fab ];
  };
}