nixpkgs-suyu/pkgs/tools/admin/berglas/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

50 lines
1.3 KiB
Nix
Raw Normal View History

{ lib, buildGoModule, fetchFromGitHub }:
2019-09-30 14:01:27 +02:00
let
skipTests = {
access = "Access";
create = "Create";
delete = "Delete";
list = "List";
read = "Read";
replace = "Replace";
resolver = "Resolve";
revoke = "Revoke";
update = "Update";
};
skipTestsCommand =
builtins.foldl' (acc: goFileName:
let testName = builtins.getAttr goFileName skipTests; in
''
${acc}
substituteInPlace pkg/berglas/${goFileName}_test.go \
--replace "TestClient_${testName}_storage" "SkipClient_${testName}_storage" \
--replace "TestClient_${testName}_secretManager" "SkipClient_${testName}_secretManager"
''
) "" (builtins.attrNames skipTests);
in
2019-09-30 14:01:27 +02:00
buildGoModule rec {
2020-03-14 16:54:07 +01:00
pname = "berglas";
version = "0.6.2";
2019-09-30 14:01:27 +02:00
src = fetchFromGitHub {
owner = "GoogleCloudPlatform";
2020-03-14 16:54:07 +01:00
repo = pname;
rev = "v${version}";
sha256 = "sha256-aLsrrK+z080qn7L2zggA8yD+QqLaSRJLTjWQnFKFogQ=";
2019-09-30 14:01:27 +02:00
};
vendorSha256 = "sha256-HjZT0jezJzoEvXuzrjoTv/zSex+xDuGoP1h82CIlX14=";
2019-09-30 14:01:27 +02:00
postPatch = skipTestsCommand;
meta = with lib; {
2019-09-30 14:01:27 +02:00
description = "A tool for managing secrets on Google Cloud";
2020-03-14 16:54:07 +01:00
homepage = "https://github.com/GoogleCloudPlatform/berglas";
2019-09-30 14:01:27 +02:00
license = licenses.asl20;
platforms = platforms.unix;
};
}