nixpkgs/pkgs/development/tools/doctl/default.nix

44 lines
1.1 KiB
Nix
Raw Normal View History

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