From dda50e73481c2db4af0c9cf783cd3b49e0cf95dd Mon Sep 17 00:00:00 2001 From: Sirio Balmelli Date: Mon, 14 Dec 2020 08:29:41 +0100 Subject: [PATCH] gopass: fix impurity which breaks gopass after 'nix-store --gc' gopass maintains a ~/.cache/gopass/gpg-binary.loc file which stores an absolute path to the gpg executable, overriding (and ignoring) the environment $PATH. This creates a situation where gopass will work for a period of time after install, but after gpg is upgraded and a 'nix-store --gc' is performed, the cached gpg path will throw an error. A gopass maintainer has declared this a wont-fix in https://github.com/gopasspw/gopass/issues/1662 As a workaround, add a --run clause in the wrapper script that removes this cache file. Once (if) upstream fixes this issue, this cruft can be removed. Signed-off-by: Sirio Balmelli --- pkgs/tools/security/gopass/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/security/gopass/default.nix b/pkgs/tools/security/gopass/default.nix index 80a9c40ebc2e..ff855cce240c 100644 --- a/pkgs/tools/security/gopass/default.nix +++ b/pkgs/tools/security/gopass/default.nix @@ -46,10 +46,12 @@ buildGoModule rec { ln -s $out/bin/gopass $out/bin/pass ''; + # --run to work around WONTFIX in https://github.com/gopasspw/gopass/issues/1662 postFixup = '' for bin in $out/bin/*; do wrapProgram $bin \ - --prefix PATH : "${wrapperPath}" + --prefix PATH : "${wrapperPath}" \ + --run 'rm -f "''${XDG_CONFIG_HOME:-~/.config}/gopass/gpg-binary.loc"' done '';