2022-09-30 11:47:45 +00:00
|
|
|
{ lib, stdenv, buildGoModule, fetchFromGitHub, pkg-config, libsecret, testers, docker-credential-helpers }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
buildGoModule rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "docker-credential-helpers";
|
2022-09-30 11:47:45 +00:00
|
|
|
version = "0.7.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "docker";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-09-30 11:47:45 +00:00
|
|
|
sha256 = "sha256-KtDWrtd88s4Al3iWxIYE+YlhZTzf8/YDVYE2AwxH8ho=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
vendorSha256 = null;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
nativeBuildInputs = lib.optionals stdenv.isLinux [ pkg-config ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isLinux [ libsecret ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X github.com/docker/docker-credential-helpers/credentials.Version=${version}"
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildPhase =
|
2022-09-30 11:47:45 +00:00
|
|
|
let
|
|
|
|
cmds = if stdenv.isDarwin then [ "osxkeychain" "pass" ] else [ "secretservice" "pass" ];
|
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
''
|
2022-09-30 11:47:45 +00:00
|
|
|
for cmd in ${builtins.toString cmds}; do
|
|
|
|
go build -ldflags "${builtins.toString ldflags}" -trimpath -o bin/docker-credential-$cmd ./$cmd/cmd
|
|
|
|
done
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
installPhase = ''
|
|
|
|
install -Dm755 -t $out/bin bin/docker-credential-*
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = docker-credential-helpers;
|
|
|
|
command = "docker-credential-pass version";
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Suite of programs to use native stores to keep Docker credentials safe";
|
|
|
|
homepage = "https://github.com/docker/docker-credential-helpers";
|
|
|
|
license = licenses.mit;
|
2022-09-30 11:47:45 +00:00
|
|
|
maintainers = with maintainers; [ marsam ];
|
2022-06-16 17:23:12 +00:00
|
|
|
} // lib.optionalAttrs stdenv.isDarwin {
|
|
|
|
mainProgram = "docker-credential-osxkeychain";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|