2022-09-29 14:32:10 +02:00
|
|
|
{ lib, stdenv, buildGoModule, fetchFromGitHub, pkg-config, libsecret, testers, docker-credential-helpers }:
|
2019-12-16 00:18:18 +01:00
|
|
|
|
2022-09-29 14:32:10 +02:00
|
|
|
buildGoModule rec {
|
2019-12-16 00:18:18 +01:00
|
|
|
pname = "docker-credential-helpers";
|
2023-08-02 11:57:19 +02:00
|
|
|
version = "0.8.0";
|
2019-12-16 00:18:18 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "docker";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2023-08-02 11:57:19 +02:00
|
|
|
sha256 = "sha256-3zWlYW+2LA/JK/lv/OTzMlF2HlQPID0WYks0dQrP3GY=";
|
2019-12-16 00:18:18 +01:00
|
|
|
};
|
|
|
|
|
2023-08-02 11:57:19 +02:00
|
|
|
vendorHash = null;
|
2022-09-29 14:32:10 +02:00
|
|
|
|
2021-01-15 10:19:50 +01:00
|
|
|
nativeBuildInputs = lib.optionals stdenv.isLinux [ pkg-config ];
|
2019-12-16 00:18:18 +01:00
|
|
|
|
2021-01-15 10:19:50 +01:00
|
|
|
buildInputs = lib.optionals stdenv.isLinux [ libsecret ];
|
2019-12-16 00:18:18 +01:00
|
|
|
|
2022-09-29 14:32:10 +02:00
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X github.com/docker/docker-credential-helpers/credentials.Version=${version}"
|
|
|
|
];
|
|
|
|
|
2019-12-16 00:18:18 +01:00
|
|
|
buildPhase =
|
2022-09-29 14:32:10 +02:00
|
|
|
let
|
|
|
|
cmds = if stdenv.isDarwin then [ "osxkeychain" "pass" ] else [ "secretservice" "pass" ];
|
|
|
|
in
|
2019-12-16 00:18:18 +01:00
|
|
|
''
|
2022-09-29 14:32:10 +02: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-16 00:18:18 +01:00
|
|
|
'';
|
|
|
|
|
2022-09-29 14:32:10 +02: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-16 00:18:18 +01:00
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2019-12-16 00:18:18 +01: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-29 14:32:10 +02:00
|
|
|
maintainers = with maintainers; [ marsam ];
|
2022-05-06 02:31:41 +02:00
|
|
|
} // lib.optionalAttrs stdenv.isDarwin {
|
|
|
|
mainProgram = "docker-credential-osxkeychain";
|
2019-12-16 00:18:18 +01:00
|
|
|
};
|
|
|
|
}
|