2022-09-29 12:32:10 +00:00
|
|
|
{ lib, stdenv, buildGoModule, fetchFromGitHub, pkg-config, libsecret, testers, docker-credential-helpers }:
|
2019-12-15 23:18:18 +00:00
|
|
|
|
2022-09-29 12:32:10 +00:00
|
|
|
buildGoModule rec {
|
2019-12-15 23:18:18 +00:00
|
|
|
pname = "docker-credential-helpers";
|
2024-05-24 00:51:34 +00:00
|
|
|
version = "0.8.2";
|
2019-12-15 23:18:18 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "docker";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2024-05-24 00:51:34 +00:00
|
|
|
sha256 = "sha256-LFXSfb4JnlacSZVnIf+5/A+KefARYadEGDzGtcSDJBw=";
|
2019-12-15 23:18:18 +00:00
|
|
|
};
|
|
|
|
|
2023-08-02 09:57:19 +00:00
|
|
|
vendorHash = null;
|
2022-09-29 12:32:10 +00:00
|
|
|
|
2021-01-15 09:19:50 +00:00
|
|
|
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ pkg-config ];
|
2019-12-15 23:18:18 +00:00
|
|
|
|
2021-01-15 09:19:50 +00:00
|
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ libsecret ];
|
2019-12-15 23:18:18 +00:00
|
|
|
|
2022-09-29 12:32:10 +00:00
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X github.com/docker/docker-credential-helpers/credentials.Version=${version}"
|
|
|
|
];
|
|
|
|
|
2019-12-15 23:18:18 +00:00
|
|
|
buildPhase =
|
2022-09-29 12:32:10 +00:00
|
|
|
let
|
|
|
|
cmds = if stdenv.hostPlatform.isDarwin then [ "osxkeychain" "pass" ] else [ "secretservice" "pass" ];
|
|
|
|
in
|
2019-12-15 23:18:18 +00:00
|
|
|
''
|
2022-09-29 12:32:10 +00:00
|
|
|
for cmd in ${builtins.toString cmds}; do
|
|
|
|
go build -ldflags "${builtins.toString ldflags}" -trimpath -o bin/docker-credential-$cmd ./$cmd/cmd
|
|
|
|
done
|
2019-12-15 23:18:18 +00:00
|
|
|
'';
|
|
|
|
|
2022-09-29 12:32:10 +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";
|
|
|
|
};
|
2019-12-15 23:18:18 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-12-15 23:18:18 +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;
|
2024-07-28 14:44:11 +00:00
|
|
|
maintainers = [ ];
|
2022-05-06 00:31:41 +00:00
|
|
|
} // lib.optionalAttrs stdenv.hostPlatform.isDarwin {
|
|
|
|
mainProgram = "docker-credential-osxkeychain";
|
2019-12-15 23:18:18 +00:00
|
|
|
};
|
|
|
|
}
|