mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-02 03:43:06 +00:00
755b915a15
nix run nixpkgs#silver-searcher -- -G '\.nix$' -0l 'description.*"[Aa]n?' pkgs \ | xargs -0 nix run nixpkgs#gnused -- -i '' -Ee 's/(description.*")[Aa]n? (.)/\1\U\2/'
62 lines
1.5 KiB
Nix
62 lines
1.5 KiB
Nix
{ lib, buildGoModule, fetchFromGitHub, testers, berglas }:
|
|
|
|
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
|
|
|
|
buildGoModule rec {
|
|
pname = "berglas";
|
|
version = "2.0.2";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "GoogleCloudPlatform";
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
sha256 = "sha256-+fpxklkcjGiBMyW+L9nNdzXwhGcE2yIbZ/wPbpj9bV0=";
|
|
};
|
|
|
|
vendorHash = "sha256-BDQJFrFbJGuoDpjGn0T9xWk6huUmDpOTO/JSDIYUKYg=";
|
|
|
|
ldflags = [
|
|
"-s"
|
|
"-w"
|
|
"-X=github.com/GoogleCloudPlatform/berglas/internal/version.Version=${version}"
|
|
];
|
|
|
|
postPatch = skipTestsCommand;
|
|
|
|
passthru.tests = {
|
|
version = testers.testVersion {
|
|
package = berglas;
|
|
};
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "Tool for managing secrets on Google Cloud";
|
|
homepage = "https://github.com/GoogleCloudPlatform/berglas";
|
|
license = licenses.asl20;
|
|
mainProgram = "berglas";
|
|
};
|
|
}
|