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 <sirio@b-ad.ch>
gstqt5
Sirio Balmelli 2020-12-14 08:29:41 +01:00
parent 1e8ca69151
commit dda50e7348
No known key found for this signature in database
GPG Key ID: 0437A96EFE4C426E
1 changed files with 3 additions and 1 deletions

View File

@ -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
'';