1{ lib
2, buildGoModule
3, fetchFromGitHub
4}:
5
6buildGoModule rec {
7 pname = "scalr-cli";
8 version = "0.15.1";
9
10 src = fetchFromGitHub {
11 owner = "Scalr";
12 repo = "scalr-cli";
13 rev = "v${version}";
14 hash = "sha256-8KhFF/bD//NYRQ7v+ksGAE6bKVu+nE3o3R119XbHVDA=";
15 };
16
17 vendorHash = "sha256-xoxSQ9V9i7yxJzn8wAtIAtWlTn4q/UnNqMT93RyBHII=";
18
19 ldflags = [
20 "-s" "-w"
21 ];
22
23 preConfigure = ''
24 # Set the version.
25 substituteInPlace main.go --replace '"0.0.0"' '"${version}"'
26 '';
27
28 postInstall = ''
29 mv $out/bin/cli $out/bin/scalr
30 '';
31
32 doCheck = false; # Skip tests as they require creating actual Scalr resources.
33
34 meta = with lib; {
35 description = "A command-line tool that communicates directly with the Scalr API.";
36 homepage = "https://github.com/Scalr/scalr-cli";
37 changelog = "https://github.com/Scalr/scalr-cli/releases/tag/v${version}";
38 license = licenses.asl20;
39 maintainers = with maintainers; [ dylanmtaylor ];
40 mainProgram = "scalr";
41 };
42}