change gpg pinentry to shell script which can determine which session type is used

This commit is contained in:
ulic-youthlic 2025-01-15 20:48:09 +08:00
parent 964ad68305
commit a8e3cb54ad
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
4 changed files with 28 additions and 4 deletions

View file

@ -4,6 +4,7 @@
...
}:
{
pinentry-selector = pkgs.callPackage ./pinentry-selector.nix { };
immersive-translate =
(pkgs.callPackage "${inputs.firefox-addons}/default.nix" { }).firefox-addons.immersive-translate;
}

View file

@ -0,0 +1,22 @@
{ pkgs }:
pkgs.writeShellApplication {
name = "pinentry";
runtimeInputs = with pkgs; [
pinentry-all
];
text = ''
case $(tty) in
/dev/tty[1-9])
pinentry-curses;;
/dev/pts/*)
if [ -z "$SSH_CLIENT" ]; then
pinentry-qt
else
pinentry-curses
fi
;;
*)
pinentry-curses;;
esac
'';
}