2020-04-10 13:19:42 +01:00
|
|
|
{ lib, buildGoPackage, fetchFromGitHub, installShellFiles }:
|
2016-07-19 11:30:35 +01:00
|
|
|
|
|
|
|
buildGoPackage rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "doctl";
|
2020-04-10 09:50:53 +01:00
|
|
|
version = "1.40.0";
|
|
|
|
|
2016-07-19 11:30:35 +01:00
|
|
|
goPackagePath = "github.com/digitalocean/doctl";
|
|
|
|
|
2020-04-10 09:50:53 +01:00
|
|
|
subPackages = [ "cmd/doctl" ];
|
|
|
|
|
|
|
|
buildFlagsArray = ''
|
|
|
|
-ldflags=
|
|
|
|
-X ${goPackagePath}.Major=${lib.versions.major version}
|
|
|
|
-X ${goPackagePath}.Minor=${lib.versions.minor version}
|
|
|
|
-X ${goPackagePath}.Patch=${lib.versions.patch version}
|
|
|
|
-X ${goPackagePath}.Label=release
|
|
|
|
'';
|
2016-11-17 22:32:21 +00:00
|
|
|
|
2020-04-10 13:19:42 +01:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
export HOME=$(mktemp -d) # attempts to write to /homeless-shelter
|
|
|
|
for shell in bash fish zsh; do
|
|
|
|
$bin/bin/doctl completion $shell > doctl.$shell
|
|
|
|
installShellCompletion doctl.$shell
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2016-07-19 11:30:35 +01:00
|
|
|
src = fetchFromGitHub {
|
2020-04-10 09:50:53 +01:00
|
|
|
owner = "digitalocean";
|
|
|
|
repo = "doctl";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "1x8rr3707mmbfnjn3ck0953xkkrfq5r8zflbxpkqlfz9k978z835";
|
2016-07-19 11:30:35 +01:00
|
|
|
};
|
|
|
|
|
2020-04-10 09:50:53 +01:00
|
|
|
meta = with lib; {
|
2016-07-19 11:30:35 +01:00
|
|
|
description = "A command line tool for DigitalOcean services";
|
2020-04-10 09:50:53 +01:00
|
|
|
homepage = "https://github.com/digitalocean/doctl";
|
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = [ maintainers.siddharthist ];
|
2016-07-19 11:30:35 +01:00
|
|
|
};
|
|
|
|
}
|