From 14b4dacdbb4ea7570346df68709217a6bee6ed77 Mon Sep 17 00:00:00 2001 From: Zexin Yuan Date: Sun, 14 Dec 2025 10:16:02 +0800 Subject: [PATCH] git-credential-gopass: remove dependency on gopass, add version check --- pkgs/tools/security/gopass/git-credential.nix | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/security/gopass/git-credential.nix b/pkgs/tools/security/gopass/git-credential.nix index 61e2751c1294..c5b2ad2852db 100644 --- a/pkgs/tools/security/gopass/git-credential.nix +++ b/pkgs/tools/security/gopass/git-credential.nix @@ -3,7 +3,9 @@ buildGoModule, fetchFromGitHub, makeWrapper, + writableTmpDirAsHomeHook, gopass, + versionCheckHook, }: buildGoModule (finalAttrs: { @@ -21,7 +23,10 @@ buildGoModule (finalAttrs: { subPackages = [ "." ]; - nativeBuildInputs = [ makeWrapper ]; + nativeBuildInputs = [ + makeWrapper + writableTmpDirAsHomeHook + ]; ldflags = [ "-s" @@ -32,7 +37,17 @@ buildGoModule (finalAttrs: { postFixup = '' wrapProgram $out/bin/git-credential-gopass \ - --prefix PATH : "${lib.makeBinPath [ gopass ]}" + --prefix PATH : "${gopass.wrapperPath}" + ''; + + doInstallCheck = true; + nativeInstallCheckInputs = [ + versionCheckHook + gopass + ]; + versionCheckKeepEnvironment = [ "HOME" ]; + preVersionCheck = '' + gopass setup --name "user" --email "user@localhost" ''; meta = {