summary refs log tree commit diff
diff options
context:
space:
mode:
authorMario Rodas <marsam@users.noreply.github.com>2022-09-29 08:48:22 -0500
committerGitHub <noreply@github.com>2022-09-29 08:48:22 -0500
commit213c5409c3808ca1e58b2f66c91e0d78c46da3a8 (patch)
treea02ab64d0956a93a1d0320219eb14bf7aea4599c
parent3f7fa3fe689ef8e94f2b317ddf812f803378e209 (diff)
parent91d1af7d8c6498712391bfa5a28a6e7104a814f2 (diff)
downloadnixpkgs-213c5409c3808ca1e58b2f66c91e0d78c46da3a8.tar
nixpkgs-213c5409c3808ca1e58b2f66c91e0d78c46da3a8.tar.gz
nixpkgs-213c5409c3808ca1e58b2f66c91e0d78c46da3a8.tar.bz2
nixpkgs-213c5409c3808ca1e58b2f66c91e0d78c46da3a8.tar.lz
nixpkgs-213c5409c3808ca1e58b2f66c91e0d78c46da3a8.tar.xz
nixpkgs-213c5409c3808ca1e58b2f66c91e0d78c46da3a8.tar.zst
nixpkgs-213c5409c3808ca1e58b2f66c91e0d78c46da3a8.zip
Merge pull request #193513 from aaronjheng/docker-credential-helpers-0.7.0
docker-credential-helpers: 0.6.3 -> 0.7.0
-rw-r--r--pkgs/tools/admin/docker-credential-helpers/default.nix52
1 files changed, 27 insertions, 25 deletions
diff --git a/pkgs/tools/admin/docker-credential-helpers/default.nix b/pkgs/tools/admin/docker-credential-helpers/default.nix
index c32c8834f8d..7859145dfdd 100644
--- a/pkgs/tools/admin/docker-credential-helpers/default.nix
+++ b/pkgs/tools/admin/docker-credential-helpers/default.nix
@@ -1,50 +1,52 @@
-{ lib, stdenv, buildGoPackage, fetchFromGitHub, pkg-config, libsecret }:
+{ lib, stdenv, buildGoModule, fetchFromGitHub, pkg-config, libsecret, testers, docker-credential-helpers }:
 
-buildGoPackage rec {
+buildGoModule rec {
   pname = "docker-credential-helpers";
-  version = "0.6.3";
-
-  goPackagePath = "github.com/docker/docker-credential-helpers";
+  version = "0.7.0";
 
   src = fetchFromGitHub {
     owner = "docker";
     repo = pname;
     rev = "v${version}";
-    sha256 = "0xgmwjva3j1s0cqkbajbamj13bgzh5jkf2ir54m9a7w8gjnsh6dx";
+    sha256 = "sha256-KtDWrtd88s4Al3iWxIYE+YlhZTzf8/YDVYE2AwxH8ho=";
   };
 
+  vendorSha256 = null;
+
   nativeBuildInputs = lib.optionals stdenv.isLinux [ pkg-config ];
 
   buildInputs = lib.optionals stdenv.isLinux [ libsecret ];
 
+  ldflags = [
+    "-s"
+    "-w"
+    "-X github.com/docker/docker-credential-helpers/credentials.Version=${version}"
+  ];
+
   buildPhase =
-    if stdenv.isDarwin
-    then ''
-      cd go/src/${goPackagePath}
-      go build -ldflags -s -o bin/docker-credential-osxkeychain osxkeychain/cmd/main_darwin.go
+    let
+      cmds = if stdenv.isDarwin then [ "osxkeychain" "pass" ] else [ "secretservice" "pass" ];
+    in
     ''
-    else ''
-      cd go/src/${goPackagePath}
-      go build -o bin/docker-credential-secretservice secretservice/cmd/main_linux.go
-      go build -o bin/docker-credential-pass pass/cmd/main_linux.go
+      for cmd in ${builtins.toString cmds}; do
+        go build -ldflags "${builtins.toString ldflags}" -trimpath -o bin/docker-credential-$cmd ./$cmd/cmd
+      done
     '';
 
-  installPhase =
-    if stdenv.isDarwin
-    then ''
-      install -Dm755 -t $out/bin bin/docker-credential-osxkeychain
-    ''
-    else ''
-      install -Dm755 -t $out/bin bin/docker-credential-pass
-      install -Dm755 -t $out/bin bin/docker-credential-secretservice
-    '';
+  installPhase = ''
+    install -Dm755 -t $out/bin bin/docker-credential-*
+  '';
+
+  passthru.tests.version = testers.testVersion {
+    package = docker-credential-helpers;
+    command = "docker-credential-pass version";
+  };
 
   meta = with lib; {
     description = "Suite of programs to use native stores to keep Docker credentials safe";
     homepage = "https://github.com/docker/docker-credential-helpers";
     license = licenses.mit;
-    maintainers = [ maintainers.marsam ];
-    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = with maintainers; [ marsam ];
   } // lib.optionalAttrs stdenv.isDarwin {
     mainProgram = "docker-credential-osxkeychain";
   };